1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/38699
3 // { dg-do compile }
4 
5 template<class T>
6 struct A
7 {
8   const T *p;
9 };
10 
11 struct B
12 {
13   A<int> a;
14 };
15 
16 template class A<char>;
17 
18 void
f0()19 f0 ()
20 {
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" }
25 }
26 
27