Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++1y/14: auto variable templates?

Tags:

c++

c++14

Is the following C++1y/C++14 program ill-formed?

template<class> constexpr auto X = 42;

int main()
{
        static_assert(X<int> == 42, "");
}

Why / why not?

Clang trunk complains that:

error: invalid operands to binary expression ('auto' and 'int')
like image 483
Andrew Tomazos Avatar asked Mar 15 '14 19:03

Andrew Tomazos


Video Answer


1 Answers

This was a bug in clang, it is now fixed: http://llvm.org/bugs/show_bug.cgi?id=19152

like image 106
Andrew Tomazos Avatar answered Sep 29 '22 17:09

Andrew Tomazos