http://llvm.org/bugs/show_bug.cgi?id=21103
Bug ID: 21103
Summary: clang does not correctly compile constexpr function
for literal types that have a non-constexpr copy
constructor
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
clang gives an error when compiling the code below.
But this should be valid c++ code, since B<-1> is a literal_type and the
requirements for f being a constexpr function call should be met. (also it
compiles with g++)
#include <array>
#include <type_traits>
#include <iostream>
template<class T, int N>
class A {
public:
T values[N];
public:
constexpr A() : values{} {}
A(const A&) {}
A(int x) {}
};
template<int... Extents>
class B
: A<int, 10>
{
};
template<class T>
constexpr int f(T) {
return 0;
}
int main() {
std::array<int, f(B<-1>())> a;
// std::cout << std::is_literal_type<B<-1>>::value << "\n"; prints true
return 0;
}
--
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