aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/class.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2008-11-17 23:24:37 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2008-11-17 23:24:37 +0000
commita11f42f4bca694b9be91350d0a74815f119e3fbf (patch)
tree35493691751a1135ae661fa761a2b2c8501aea2d /test/SemaCXX/class.cpp
parent10bd36882406cdf4805e35add1ce2f11ab9ae152 (diff)
Implement effects of 'mutable', and a few comments from Chris on its parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/class.cpp')
-rw-r--r--test/SemaCXX/class.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/SemaCXX/class.cpp b/test/SemaCXX/class.cpp
index ada508ac32..b7d1ca34dc 100644
--- a/test/SemaCXX/class.cpp
+++ b/test/SemaCXX/class.cpp
@@ -82,6 +82,18 @@ class C2 {
}
};
+struct C3 {
+ int i;
+ mutable int j;
+};
+void f()
+{
+ const C3 c3 = { 1, 2 };
+ (void)static_cast<int*>(&c3.i); // expected-error {{static_cast from 'int const *' to 'int *' is not allowed}}
+ // but no error here
+ (void)static_cast<int*>(&c3.j);
+}
+
// 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}}