Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / other / offsetof6.C
blobb77d1b99a77465d5e74e193561b513c4623f4397
1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/38699
3 // { dg-do compile }
5 template<class T>
6 struct A
8   const T *p;
9 };
11 struct B
13   A<int> a;
16 template class A<char>;
18 void
19 f0 ()
21   __builtin_offsetof(A<char>, p); // OK
22   __builtin_offsetof(A<char>, p[1]); // { dg-error "non constant address" }
23   __builtin_offsetof(B, a.p); // OK
24   __builtin_offsetof(B, a.p[1]); // { dg-error "non constant address" }