• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
2 
3 struct S {
4   S *p = this; // ok
5   decltype(this) q; // expected-error {{invalid use of 'this' outside of a nonstatic member function}} \
6                        expected-error {{C++ requires a type specifier for all declarations}}
7 
8   int arr[sizeof(this)]; // expected-error {{invalid use of 'this' outside of a nonstatic member function}}
9   int sz = sizeof(this); // ok
10 };
11