Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | 2988205 | 2008-12-10 21:26:49 +0000 | [diff] [blame] | 2 | // PR clang/3175 |
| 3 | |
| 4 | void bar(int*); |
| 5 | |
| 6 | class c { |
| 7 | int var; |
| 8 | static int svar; |
| 9 | void foo() { |
| 10 | bar(&var); |
| 11 | bar(&svar); |
| 12 | } |
| 13 | |
| 14 | static void wibble() { |
| 15 | bar(&var); // expected-error{{invalid use of member 'var' in static member function}} |
| 16 | bar(&svar); |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | enum E { |
| 21 | Enumerator |
| 22 | }; |
| 23 | |
| 24 | void test() { |
| 25 | (void)&Enumerator; // expected-error{{address expression must be an lvalue or a function designator}} |
| 26 | } |
| 27 | |
| 28 | template<int N> |
| 29 | void test2() { |
| 30 | (void)&N; // expected-error{{address expression must be an lvalue or a function designator}} |
| 31 | } |
Nuno Lopes | 6fea8d2 | 2008-12-16 22:58:26 +0000 | [diff] [blame] | 32 | |
| 33 | // PR clang/3222 |
| 34 | void xpto(); |
| 35 | void (*xyz)(void) = &xpto; |