diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-17 23:24:37 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-17 23:24:37 +0000 |
commit | 8071edb29794401c3aba27fc300ba78800e898e7 (patch) | |
tree | 0191d612b97bed6d34a50afc39ac9464cd222d82 /clang/test/SemaCXX/class.cpp | |
parent | 92751d41a0a09020db5868e8aafb6aef2de3ad8e (diff) | |
download | bcm5719-llvm-8071edb29794401c3aba27fc300ba78800e898e7.tar.gz bcm5719-llvm-8071edb29794401c3aba27fc300ba78800e898e7.zip |
Implement effects of 'mutable', and a few comments from Chris on its parsing.
llvm-svn: 59470
Diffstat (limited to 'clang/test/SemaCXX/class.cpp')
-rw-r--r-- | clang/test/SemaCXX/class.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/class.cpp b/clang/test/SemaCXX/class.cpp index ada508ac322..b7d1ca34dcf 100644 --- a/clang/test/SemaCXX/class.cpp +++ b/clang/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}} |