diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/parse/offsetof7.C')
-rw-r--r-- | gcc/testsuite/g++.dg/parse/offsetof7.C | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/parse/offsetof7.C b/gcc/testsuite/g++.dg/parse/offsetof7.C new file mode 100644 index 000000000..113a79547 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/offsetof7.C @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +// From PR28573 + +struct A +{ + int operator [] ( int indx ) { return indx; } +}; + +struct B +{ + A a; +}; + +int main() +{ + return __builtin_offsetof(B, a[0]); /* { dg-error "cannot apply.*offsetof" } */ +} |