https://bugs.llvm.org/show_bug.cgi?id=32926

            Bug ID: 32926
           Summary: clang fails to compile constexpr with -O0/-O1
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 18411
  --> https://bugs.llvm.org/attachment.cgi?id=18411&action=edit
Reproducer.

clangc fails to compile constexpr at -O0 and -O2 with -std=c++11 and
-std=c++14. 

Reproducer:
>$ cat repr.cpp 
#include <iostream>
#include <utility>

template<typename T>
void foo() {
    std::cout << T::debug_typeid << std::endl;
    std::make_pair(T::debug_typeid, T::debug_typeid);
}

struct A {
    static constexpr uint32_t debug_typeid = 1;
}; 

int main () {
    foo<A>();
}

Error:
>$ clang++ -std=c++11 repr.cpp -O0 ; ./a.out
/tmp/repr-ac99cc.o: In function `void foo<A>()':
repr.cpp:(.text._Z3fooI1AEvv[_Z3fooI1AEvv]+0x30): undefined reference to
`A::debug_typeid'
clang-5.0: error: linker command failed with exit code 1 (use -v to see
invocation)

clang version 5.0.0 (trunk 302068)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to