• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // PR clang/3175
3 
4 void bar(int*);
5 
6 class c {
7   int var;
8   static int svar;
foo()9   void foo() {
10     bar(&var);
11     bar(&svar);
12   }
13 
wibble()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 
test()24 void test() {
25   (void)&Enumerator; // expected-error{{address expression must be an lvalue or a function designator}}
26 }
27 
28 template<int N>
test2()29 void test2() {
30   (void)&N; // expected-error{{address expression must be an lvalue or a function designator}}
31 }
32 
33 // PR clang/3222
34 void xpto();
35 void (*xyz)(void) = &xpto;
36 
37 struct PR11066 {
38   static int foo(short);
39   static int foo(float);
40   void test();
41 };
42 
test()43 void PR11066::test() {
44   int (PR11066::*ptr)(int) = & &PR11066::foo; // expected-error{{address expression must be an lvalue or a function designator}}
45 }
46 
47