diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Parser/cxx-class.cpp | 1 | ||||
-rw-r--r-- | clang/test/SemaCXX/class.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp index ef0c901dfa5..5afa8d6ac23 100644 --- a/clang/test/Parser/cxx-class.cpp +++ b/clang/test/Parser/cxx-class.cpp @@ -21,6 +21,7 @@ private: int x,f(),y,g(); inline int h(); static const int sci = 10; + mutable int mi; }; void glo() { 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}} +} |