[llvm-dev] __is_empty type-trait implementation in llvm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[llvm-dev] __is_empty type-trait implementation in llvm

Hal Finkel via llvm-dev
Hi all,

In c++11 and above, llvm supports many type traits like __is_empty, __is_abstract etc. 
GCC throws an error if we pass an array of incomplete type with unknown bounds, saying incomplete type. 
LLVM also throws an error for some particular type traits and not for others. 

Of what I have read, the standard specifies to accept only complete type or void for is_empty. 
But in the code, if we pass an array of unknown bounds, it still compiles.

Example code: 

struct I;
int a = __is_empty(I[])

This compiles in the current svn. Whereas isn't it supposed to give incomplete type error, like GCC? 

Thanks & Regards,
Puneetha

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [llvm-dev] __is_empty type-trait implementation in llvm

Hal Finkel via llvm-dev

+cfe-dev

From [meta.unary.prop], for std::is_empty: "If T is a non-union class type, T shall be a complete type.". Since an incomplete array type isn't a class type, we don't need to require the complete type here, AFAIK.

Thanks,
Erik

On 6/6/17 5:18 AM, Puneetha K via llvm-dev wrote:

Hi all,

In c++11 and above, llvm supports many type traits like __is_empty, __is_abstract etc. 
GCC throws an error if we pass an array of incomplete type with unknown bounds, saying incomplete type. 
LLVM also throws an error for some particular type traits and not for others. 

Of what I have read, the standard specifies to accept only complete type or void for is_empty. 
But in the code, if we pass an array of unknown bounds, it still compiles.

Example code: 

struct I;
int a = __is_empty(I[])

This compiles in the current svn. Whereas isn't it supposed to give incomplete type error, like GCC? 

Thanks & Regards,
Puneetha


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Loading...