[cfe-dev] C++11 POD bug

Kal Conley kcconley at gmail.com
Sun Jun 3 08:50:16 PDT 2012


Hi Suman,

I updated to clang 3.2 r157900 and it does work now. Both of my examples
compile without warnings with -std=c++11. Thanks!

Thanks for the interesting links too.

Regards,
Kal

Am 6/3/12 3:19 PM, schrieb Suman Kar:
> On Sun, Jun 3, 2012 at 4:38 PM, Kal Conley <kcconley at gmail.com> wrote:
>> Hi,
>>
>> You are probably correct about that. But the compiler isn't complaining
>> about the VLA itself, only that the type is a non-POD. I think "Pod"
>> should be a POD type in c++11. Here is a more direct example:
>>
>> $ cat pod.cc
>> #include <type_traits>
>> struct Pod {
>>  int i;
>>  Pod() = default;
>> };
>>
>> static_assert(std::is_pod<Pod>::value, "Pod should be a POD");
>>
>>
> As I said, this compiles just fine with my 3.2 (trunk 157155). On
> further digging I found that VLAs are in fact supported by clang
> (<http://clang.llvm.org/compatibility.html#vla>) as an extension. So,
> the following:
>
> $ cat vla.cpp
> #include <type_traits>
> struct Pod {
>  int i;
>  Pod() = default;
> };
>
> #if __has_extension(is_pod)
> static_assert(std::is_pod<Pod>::value, "Pod should be a POD");
> #endif
>
> int main(int argc, char **argv) {
>  int Size = 1;
>  struct Pod PodArray[Size];
>  return 0;
> }
>
> compiles fine with std=gnu++0x. You are probably better off with a
> check for any type_trait member you are using (see
> <http://clang.llvm.org/docs/LanguageExtensions.html#checking_type_traits>).
>
> Can you possibly sync up and see if this problem still exists?
>
> Regards,
> Suman




More information about the cfe-dev mailing list