diff options
Diffstat (limited to 'clang/test/Sema/parentheses.cpp')
-rw-r--r-- | clang/test/Sema/parentheses.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Sema/parentheses.cpp b/clang/test/Sema/parentheses.cpp index ad1f399c649..a25f2a0ce7b 100644 --- a/clang/test/Sema/parentheses.cpp +++ b/clang/test/Sema/parentheses.cpp @@ -16,3 +16,16 @@ void conditional_op(int x, int y, bool b) { // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ // expected-note {{place parentheses around the * expression to silence this warning}} } + +class Stream { +public: + operator int(); + Stream &operator<<(int); + Stream &operator<<(const char*); +}; + +void f(Stream& s, bool b) { + (void)(s << b ? "foo" : "bar"); // expected-warning {{?: has lower precedence than <<}} \ + // expected-note {{place parentheses around the ?: expression to evaluate it first}} \ + // expected-note {{place parentheses around the << expression to silence this warning}} +} |