p4-0x.cpp revision 42d6d0c91ab089cb252ab2f91c16d4557f458a2c
1// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 2 3struct S { 4 S *p = this; // ok 5 decltype(this) q; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} 6 7 int arr[sizeof(this)]; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} 8 int sz = sizeof(this); // ok 9}; 10