[cfe-dev] Try out LLVM: no C++0x & crash

Matthieu Monrocq matthieu.monrocq at gmail.com
Tue Aug 23 23:23:44 PDT 2011


Hello,

Following a question about POD-ness on StackOverflow, I tried the following
snippet on Clang via the Try Out LLVM page:

#include <type_traits>

struct B
{
  int a;
  B(int aa) : a(aa) {}
  B() = default;
};

static_assert(std::is_pod<B>::value, "B should be POD");

2 problems arose:

1. Clang does not use C++0x, and there is no option to make it so, thus the
header cannot be parsed
2. It caused a crash (probably because the header could not be parsed)

Here is the output generated:

In file included from /tmp/webcompile/_12647_0.cc:1:
In file included from /usr/include/c++/4.3.3/type_traits:39:
/usr/include/c++/4.3.3/c++0x_warning.h:36:2: error: #error This file
requires compiler and library support for the upcoming ISO C++
standard, C++0x. This support is currently experimental, and must be
enabled with the -std=c++0x or -std=gnu++0x compiler options.
#error This file requires compiler and library support for the upcoming \
 ^
In file included from /tmp/webcompile/_12647_0.cc:1:
In file included from /usr/include/c++/4.3.3/type_traits:55:
/usr/include/c++/4.3.3/tr1_impl/type_traits:296:38: error: expected expression
    : public integral_constant<bool, __has_virtual_destructor(_Tp)>
                                     ^
/usr/include/c++/4.3.3/tr1_impl/type_traits:297:5: error: expected class name
    { };
    ^
In file included from /tmp/webcompile/_12647_0.cc:1:
/usr/include/c++/4.3.3/type_traits:81:35: error: rvalue references are
only allowed in C++0x
    struct is_rvalue_reference<_Tp&&>
                                  ^
/usr/include/c++/4.3.3/type_traits:105:32: error: rvalue references
are only allowed in C++0x
    struct remove_reference<_Tp&&>
                               ^
/usr/include/c++/4.3.3/type_traits:135:18: error: rvalue references
are only allowed in C++0x
    { typedef _Tp&&   type; };
                 ^
/usr/include/c++/4.3.3/type_traits:208:38: error: expected expression
    : public integral_constant<bool, __has_nothrow_constructor(_Tp)>
                                     ^
/usr/include/c++/4.3.3/type_traits:209:5: error: expected class name
    { };
    ^
/usr/include/c++/4.3.3/type_traits:214:38: error: expected expression
    : public integral_constant<bool, __has_nothrow_copy(_Tp)>
                                     ^
/usr/include/c++/4.3.3/type_traits:215:5: error: expected class name
    { };
    ^
/usr/include/c++/4.3.3/type_traits:220:38: error: expected expression
    : public integral_constant<bool, __has_nothrow_assign(_Tp)>
                                     ^
/usr/include/c++/4.3.3/type_traits:221:5: error: expected class name
    { };
    ^
/usr/include/c++/4.3.3/type_traits:226:38: error: expected expression
    : public integral_constant<bool, __is_base_of(_Base, _Derived)>
                                     ^
/usr/include/c++/4.3.3/type_traits:227:5: error: expected class name
    { };
    ^
clang: Expr.cpp:1600: ICEDiag CheckICE(const clang::Expr*,
clang::ASTContext&): Assertion `!E->isValueDependent() && "Should not
see value dependent exprs!"' failed.
0  clang           0x00000000011d16af
1  clang           0x00000000011d1ed1
2  libpthread.so.0 0x00007f72dc7c0080
3  libc.so.6       0x00007f72dbac3fb5 gsignal + 53
4  libc.so.6       0x00007f72dbac5bc3 abort + 387
5  libc.so.6       0x00007f72dbabcf09 __assert_fail + 233
6  clang           0x00000000008fe28c
7  clang           0x00000000008fe5e4
8  clang           0x0000000000685cbd
9  clang           0x000000000068ee83
10 clang           0x000000000068fa99
11 clang           0x00000000006720cb
12 clang           0x00000000009745f9
13 clang           0x00000000009671e3
14 clang           0x0000000000971c37
15 clang           0x00000000009734c5
16 clang           0x000000000097471f
17 clang           0x00000000009671e3
18 clang           0x0000000000971c37
19 clang           0x00000000009734c5
20 clang           0x000000000097471f
21 clang           0x00000000009671e3
22 clang           0x000000000098b509
23 clang           0x000000000098daa1
24 clang           0x000000000098dd39
25 clang           0x000000000096b285
26 clang           0x0000000000960330
27 clang           0x00000000009714eb
28 clang           0x000000000096b260
29 clang           0x0000000000960330
30 clang           0x000000000096053a
31 clang           0x000000000062fceb
32 clang           0x0000000000441792
33 clang           0x0000000000433e94
34 clang           0x0000000000436d81 main + 1841
35 libc.so.6       0x00007f72dbaaf5a6 __libc_start_main + 230
36 clang           0x0000000000431af9
Stack dump:
0.	Program arguments: /opt/clang-releases/llvm-2.7/bin/clang -cc1
-triple x86_64-unknown-linux-gnu -emit-llvm-bc -disable-free
-main-file-name _12647_0.cc -mrelocation-model static
-mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu
x86-64 -target-feature +sse3 -resource-dir
/opt/clang-releases/llvm-2.7/lib/clang/1.1 -O3 -W -Wall
-fmessage-length 0 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -o /tmp/webcompile/_12647_0.bc -x c++
/tmp/webcompile/_12647_0.cc
1.	/usr/include/c++/4.3.3/type_traits:310:48: current parser token '{'
2.	/usr/include/c++/4.3.3/type_traits:62:1: parsing namespace 'std'
3.	/usr/include/c++/4.3.3/type_traits:305:5: parsing
struct/union/class body 'std::aligned_storage'
4.	/usr/include/c++/4.3.3/type_traits:307:7: parsing
struct/union/class body 'std::aligned_storage::type'
clang: error: compiler command failed due to signal 6 (use -v to see invocation)

I know that traditionnaly we're supposed to produced preprocessed files,
however I cannot submit an arbitrary command line to the Try Out LLVM page.

--Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110824/b400ea35/attachment.html>


More information about the cfe-dev mailing list