8sa1-gcc/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
Marc Glisse d0ff1cb4d9 decl.c (grokdeclarator): constexpr only implies const in C++11.
2014-10-09  Marc Glisse  <marc.glisse@inria.fr>

gcc/cp/
	* decl.c (grokdeclarator): constexpr only implies const in C++11.
gcc/testsuite/
	* g++.dg/cpp0x/constexpr-52892-1.C: Error on missing const in C++14.
	* g++.dg/cpp0x/constexpr-array-ptr7.C: Likewise.
	* g++.dg/cpp0x/constexpr-diag1.C: Add const.
	* g++.dg/cpp0x/constexpr-diag3.C: Likewise.
	* g++.dg/cpp0x/constexpr-ex1.C: Likewise.
	* g++.dg/cpp0x/constexpr-ex2.C: Likewise.
	* g++.dg/cpp0x/constexpr-ex4.C: Likewise.
	* g++.dg/cpp0x/constexpr-initlist.C: Likewise.
	* g++.dg/cpp0x/constexpr-ptrmem.C: Likewise.
	* g++.dg/cpp0x/constexpr-ptrsub.C: Likewise.
	* g++.dg/cpp0x/constexpr-ref4.C: Likewise.
	* g++.dg/cpp0x/constexpr-static6.C: Likewise.

From-SVN: r216039
2014-10-09 13:53:54 +00:00

21 lines
349 B
C

// PR c++/49290
// { dg-do compile { target c++11 } }
typedef unsigned T;
struct S
{
constexpr T foo (void);
unsigned s1[16];
};
constexpr T
S::foo ()
{
return *(T *) (s1 + 10);
}
constexpr S s = { 0,1,2,3,4,5,6,7,8,9,10 };
#define SA(X) static_assert ((X), #X)
SA(s.foo() == 10); // { dg-error "discards qualifiers" "" { target c++14 } }