brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 373e44c Raw
55 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// PR clang/31753 4void bar(int*);5 6class 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 20enum E {21  Enumerator22};23 24void test() {25  (void)&Enumerator; // expected-error{{cannot take the address of an rvalue of type 'E'}}26}27 28template<int N>29void test2() {30  (void)&N; // expected-error{{cannot take the address of an rvalue of type 'int'}}31}32 33// PR clang/322234void xpto();35void (*xyz)(void) = &xpto;36 37struct PR11066 {38  static int foo(short);39  static int foo(float);40  void test();41};42 43void PR11066::test() {44  int (PR11066::*ptr)(int) = & &PR11066::foo; // expected-error{{extra '&' taking address of overloaded function}}45}46 47namespace test3 {48  // emit no error49  template<typename T> struct S {50    virtual void f() = 0;51  };52  template<typename T> void S<T>::f() { T::error; }53  void (S<int>::*p)() = &S<int>::f;54}55