summaryrefslogtreecommitdiff
path: root/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp')
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
index 4873c095a0ebf..e2d94fbf3811a 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6.cpp
@@ -1,14 +1,20 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
-void f() const; // expected-error{{type qualifier is not allowed on this function}}
+typedef void F() const;
+
+void f() const; // expected-error {{non-member function cannot have 'const' qualifier}}
+F g; // expected-error {{non-member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}
struct X {
void f() const;
- friend void g() const; // expected-error{{type qualifier is not allowed on this function}}
- static void h() const; // expected-error{{type qualifier is not allowed on this function}}
+ friend void g() const; // expected-error {{non-member function cannot have 'const' qualifier}}
+ static void h() const; // expected-error {{static member function cannot have 'const' qualifier}}
+ F i; // ok
+ friend F j; // expected-error {{non-member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}
+ static F k; // expected-error {{static member function of type 'F' (aka 'void () const') cannot have 'const' qualifier}}
};
struct Y {
friend void X::f() const;
- friend void ::f() const; // expected-error{{type qualifier is not allowed on this function}}
+ friend void ::f() const; // expected-error {{non-member function cannot have 'const' qualifier}}
};