summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-array-ptr7.C
blob: 005f5300d6f34d9bcd911736ad5c54781c4e6e09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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 } }