8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-function3.C
Jason Merrill 4b2e63def5 g++-dg.exp (g++-dg-runtest): Run tests in C++1y mode, too.
* lib/g++-dg.exp (g++-dg-runtest): Run tests in C++1y mode, too.
	* lib/target-supports.exp (check_effective_target_c++11): Now
	means C++11 and up.
	(check_effective_target_c++11_only): New.
	(check_effective_target_c++11_down): New.
	(check_effective_target_c++1y): New.
	(check_effective_target_c++1y_only): New.
	(check_effective_target_c++98_only): Rename from
	check_effective_target_c++98.
	* g++.dg/*: Use { target c++11 } instead of -std=c++11.

From-SVN: r208416
2014-03-07 15:01:12 -05:00

30 lines
541 B
C

// { dg-do compile { target c++11 } }
// From N2235
// function template 1
template<typename T>
constexpr int bytesize(T t)
{ return sizeof (t); } // OK
char buf[bytesize(0)]; // OK -- not C99 VLA
// function template 2
template<typename _Tp>
constexpr _Tp
square(_Tp x) { return x; }
// Explicit specialization
template<>
constexpr unsigned long
square(unsigned long x) { return x * x; }
// Explicit instantiation
template int square(int);
class A { };
template A square(A);
template long square(long);