brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · a035086 Raw
34 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3typedef void F() const;4 5void f() const; // expected-error {{non-member function cannot have 'const' qualifier}}6F g; // expected-error {{non-member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}7 8struct X {9  void f() const;10  friend void g() const; // expected-error {{non-member function cannot have 'const' qualifier}}11  static void h() const; // expected-error {{static member function cannot have 'const' qualifier}}12  F i; // ok13  friend F j; // expected-error {{non-member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}14  static F k; // expected-error {{static member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}15};16 17struct Y {18  friend void X::f() const;19  friend void ::f() const; // expected-error {{non-member function cannot have 'const' qualifier}}20};21 22template<typename T> struct S {23  typedef T F;24  typedef T *P; // expected-error {{pointer to function type 'void () const' cannot have 'const' qualifier}}25  typedef T &R; // expected-error {{reference to function type 'void () const' cannot have 'const' qualifier}}26};27S<F> s; // expected-note {{in instantiation of}}28 29// FIXME: This is ill-formed.30template<typename T> struct U {31  void f(T);32};33U<F> u;34