8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-base6b.C
Paolo Carlini eedb990a49 decl.c (compute_array_index_type_loc): New, like the current compute_array_index_type but takes a location_t too.
/cp
2018-11-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (compute_array_index_type_loc): New, like the current
	compute_array_index_type but takes a location_t too.
	(compute_array_index_type): Forward to the latter.
	(create_array_type_for_decl): Use compute_array_index_type_loc.

/testsuite
2018-11-29  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/constexpr-base6b.C: New.
	* g++.dg/cpp0x/constexpr-47969.C: Test locations too.
	* g++.dg/cpp0x/constexpr-48324.C: Likewise.
	* g++.dg/cpp0x/constexpr-ex2.C: Likewise.
	* g++.dg/cpp0x/scoped_enum2.C: Likewise.
	* g++.dg/cpp1y/pr63996.C: Likewise.
	* g++.dg/ext/constexpr-vla5.C: Likewise.
	* g++.dg/ext/stmtexpr15.C: Likewise.
	* g++.dg/ext/vla1.C: Likewise.
	* g++.dg/other/fold1.C: Likewise.
	* g++.dg/parse/array-size2.C: Likewise.
	* g++.dg/parse/crash36.C: Likewise.
	* g++.dg/ubsan/pr81530.C: Likewise.
	* g++.dg/warn/Wvla-1.C: Likewise.
	* g++.dg/warn/Wvla-2.C: Likewise.
	* g++.old-deja/g++.brendan/array1.C: Likewise.
	* g++.old-deja/g++.bugs/900402_02.C: Likewise.
	* g++.old-deja/g++.law/init3.C: Likewise.
	* g++.old-deja/g++.mike/p6149.C: Likewise.

From-SVN: r266645
2018-11-29 21:34:38 +00:00

14 lines
365 B
C

// CWG issue 2310
// { dg-do compile { target c++11 } }
template<typename A, typename B> struct check_derived_from {
static A a;
static constexpr B *p = &a; // { dg-error "cannot convert" }
int ar[p-p+1]; // { dg-error "13:size of array is not an integral constant-expression" }
};
struct W { int i; };
struct Z : W
{
check_derived_from<Z, W> cdf;
};