summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/function-type-qual.cpp
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/SemaCXX/function-type-qual.cpp
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'test/SemaCXX/function-type-qual.cpp')
-rw-r--r--test/SemaCXX/function-type-qual.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/SemaCXX/function-type-qual.cpp b/test/SemaCXX/function-type-qual.cpp
new file mode 100644
index 0000000..f1d5aac
--- /dev/null
+++ b/test/SemaCXX/function-type-qual.cpp
@@ -0,0 +1,23 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+void f() const; // expected-error {{type qualifier is not allowed on this function}}
+
+typedef void cfn() const;
+cfn f2; // expected-error {{a qualified function type cannot be used to declare a nonmember function or a static member function}}
+
+class C {
+ void f() const;
+ cfn f2;
+ static void f3() const; // expected-error {{type qualifier is not allowed on this function}}
+ static cfn f4; // expected-error {{a qualified function type cannot be used to declare a nonmember function or a static member function}}
+
+ void m1() {
+ x = 0;
+ }
+
+ void m2() const {
+ x = 0; // expected-error {{read-only variable is not assignable}}
+ }
+
+ int x;
+};
OpenPOWER on IntegriCloud