diff options
Diffstat (limited to 'test/SemaCXX/conditional-expr.cpp')
-rw-r--r-- | test/SemaCXX/conditional-expr.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/test/SemaCXX/conditional-expr.cpp b/test/SemaCXX/conditional-expr.cpp index a09ff2b..f37ccc8 100644 --- a/test/SemaCXX/conditional-expr.cpp +++ b/test/SemaCXX/conditional-expr.cpp @@ -199,17 +199,24 @@ void test() } namespace PR6595 { + struct OtherString { + OtherString(); + OtherString(const char*); + }; + struct String { String(const char *); + String(const OtherString&); operator const char*() const; }; - void f(bool Cond, String S) { + void f(bool Cond, String S, OtherString OS) { (void)(Cond? S : ""); (void)(Cond? "" : S); const char a[1] = {'a'}; (void)(Cond? S : a); (void)(Cond? a : S); + (void)(Cond? OS : S); } } @@ -275,3 +282,25 @@ namespace rdar7998817 { : X()); } } + +namespace PR7598 { + enum Enum { + v = 1, + }; + + const Enum g() { // expected-warning{{type qualifier on return type has no effect}} + return v; + } + + const volatile Enum g2() { // expected-warning{{'const volatile' type qualifiers on return type have no effect}} + return v; + } + + void f() { + const Enum v2 = v; + Enum e = false ? g() : v; + Enum e2 = false ? v2 : v; + Enum e3 = false ? g2() : v; + } + +} |