gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr6.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

18 lines
500 B
C

// { dg-do compile { target c++11 } }
typedef decltype(sizeof(char)) size_type;
template<class T, size_type N>
constexpr size_type size(T (&)[N]) { return N; }
double array_double[] = { 1.0, 2.0, 3.0 };
constexpr auto sz_d = size(array_double);
static_assert(sz_d == 3, "Array size failure");
void f(bool (&param)[2]) {
static_assert(size(param) == 2, "Array size failure"); // Line 13
short data[] = {-1, 2, -45, 6, 88, 99, -345};
static_assert(size(data) == 7, "Array size failure");
}