http://llvm.org/bugs/show_bug.cgi?id=18283

            Bug ID: 18283
           Summary: Const int initialized with curly braces is not a
                    compile time constant
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

While compiling the following code in C++98 or C++03 (not in C++11) mode Clang
produces an error:

template <int> struct A {};

int const i = { 42 };
typedef A<i> Ai;


The error:

test.cpp:4:11: error: non-type template argument of type 'int' is not an
integral constant expression
typedef A<i> Ai;
          ^
test.cpp:4:11: note: initializer of 'i' is not a constant expression
test.cpp:3:11: note: declared here
int const i = { 42 };
          ^

As far as I understand "i = 42" and "i = { 42 }" should be equivalent and
should produce no error.


The following code compiles without problems:

int const j = 42;
typedef A<j> Aj;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to