https://bugs.llvm.org/show_bug.cgi?id=37863
Bug ID: 37863
Summary: non-type template argument is not a constant
expression
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
The code is as follow:
template <class T> struct B;
template <bool b>
struct C { };
template <class T>
struct A: C<B<A<T>>::value>
{
typedef T Type;
};
template<class T>
struct B
{
template<typename X> static int check(typename X::Type*);
template<typename> static char check(...);
static const bool value = (sizeof(check<T>(0)) == sizeof(int));
};
int main()
{
return B<A<int>>::value;
}
clang++ rejects the code with error messages:
error: non-type template argument is not a constant expression
struct A: C<B<A<T>>::value>
The code sample comes from a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255
A previous version of g++ also rejects the code, but it is fixed.
Would you please check whether it indicates a bug in clang++?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs