2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2009-08-06 07:56:26 +08:00
|
|
|
|
|
|
|
class Outer {
|
|
|
|
int x;
|
|
|
|
static int sx;
|
2010-11-27 00:28:07 +08:00
|
|
|
int f();
|
2009-08-06 07:56:26 +08:00
|
|
|
|
2012-04-05 09:13:04 +08:00
|
|
|
// 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.
|
2009-08-06 07:56:26 +08:00
|
|
|
class Inner {
|
2012-04-05 09:13:04 +08:00
|
|
|
static char a[sizeof(x)]; // expected-error {{invalid use of non-static data member 'x'}}
|
2009-08-06 07:56:26 +08:00
|
|
|
static char b[sizeof(sx)]; // okay
|
2011-12-15 08:38:15 +08:00
|
|
|
static char c[sizeof(f)]; // expected-error {{call to non-static member function without an object argument}}
|
2009-08-06 07:56:26 +08:00
|
|
|
};
|
|
|
|
};
|