summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/class.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-11-14 23:42:31 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-11-14 23:42:31 +0000
commitccdfabab351ae15ee2bb8cfd14ee2614761bbfde (patch)
tree7e969e6177f8024faf4e691ae9a2b95522edbc21 /clang/test/SemaCXX/class.cpp
parent494d410b3200552f6bd0da2554f05b1c7f7d321e (diff)
downloadbcm5719-llvm-ccdfabab351ae15ee2bb8cfd14ee2614761bbfde.tar.gz
bcm5719-llvm-ccdfabab351ae15ee2bb8cfd14ee2614761bbfde.zip
Implement parsing and semantic checking of the 'mutable' keyword.
Thanks to Doug for the review. Actual effects of mutable to follow. llvm-svn: 59331
Diffstat (limited to 'clang/test/SemaCXX/class.cpp')
-rw-r--r--clang/test/SemaCXX/class.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/class.cpp b/clang/test/SemaCXX/class.cpp
index 7eeecdc5770..ada508ac322 100644
--- a/clang/test/SemaCXX/class.cpp
+++ b/clang/test/SemaCXX/class.cpp
@@ -61,6 +61,11 @@ private:
int x,y;
static int sx;
+ mutable int mi;
+ mutable int &mir; // expected-error {{error: 'mutable' cannot be applied to references}}
+ mutable void mfn(); // expected-error {{error: 'mutable' cannot be applied to functions}}
+ mutable const int mci; // expected-error {{error: 'mutable' and 'const' cannot be mixed}}
+
static const int number = 50;
static int arr[number];
};
@@ -76,3 +81,11 @@ class C2 {
};
}
};
+
+// Play with mutable a bit more, to make sure it doesn't crash anything.
+mutable int gi; // expected-error {{error: 'mutable' can only be applied to member variables}}
+mutable void gfn(); // expected-error {{illegal storage class on function}}
+void ogfn()
+{
+ mutable int ml; // expected-error {{error: 'mutable' can only be applied to member variables}}
+}
OpenPOWER on IntegriCloud