18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s 2*85dec559SCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3*85dec559SCharles Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 413c5a27cSJohn McCall 513c5a27cSJohn McCall class Outer { 613c5a27cSJohn McCall int x; 713c5a27cSJohn McCall static int sx; 834620310SSebastian Redl int f(); 913c5a27cSJohn McCall 10fa0a1f53SRichard Smith // C++11 does relax this rule (see 5.1.1.10) in the first case, but we need to enforce it in C++03 mode. 1113c5a27cSJohn McCall class Inner { 12*85dec559SCharles Li static char a[sizeof(x)]; 13*85dec559SCharles Li #if __cplusplus <= 199711L 14*85dec559SCharles Li // expected-error@-2 {{invalid use of non-static data member 'x'}} 15*85dec559SCharles Li #endif 1613c5a27cSJohn McCall static char b[sizeof(sx)]; // okay 1734620310SSebastian Redl static char c[sizeof(f)]; // expected-error {{call to non-static member function without an object argument}} 1813c5a27cSJohn McCall }; 1913c5a27cSJohn McCall }; 20