summaryrefslogtreecommitdiffstats
path: root/test/Sema/parentheses.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerdim <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit056abd2059c65a3e908193aeae16fad98017437c (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Sema/parentheses.cpp
parentcc73504950eb7b5dff2dded9bedd67bc36d64641 (diff)
downloadFreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip
FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'test/Sema/parentheses.cpp')
-rw-r--r--test/Sema/parentheses.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/Sema/parentheses.cpp b/test/Sema/parentheses.cpp
index 7674166..8f5f246 100644
--- a/test/Sema/parentheses.cpp
+++ b/test/Sema/parentheses.cpp
@@ -22,6 +22,8 @@ public:
operator int();
Stream &operator<<(int);
Stream &operator<<(const char*);
+ Stream &operator>>(int);
+ Stream &operator>>(const char*);
};
void f(Stream& s, bool b) {
@@ -45,3 +47,13 @@ void test(S *s, bool (S::*m_ptr)()) {
// Don't crash on unusual member call expressions.
(void)((s->*m_ptr)() ? "foo" : "bar");
}
+
+void test(int a, int b, int c) {
+ (void)(a >> b + c); // expected-warning {{operator '>>' has lower precedence than '+'; '+' will be evaluated first}} \
+ expected-note {{place parentheses around the '+' expression to silence this warning}}
+ (void)(a - b << c); // expected-warning {{operator '<<' has lower precedence than '-'; '-' will be evaluated first}} \
+ expected-note {{place parentheses around the '-' expression to silence this warning}}
+ Stream() << b + c;
+ Stream() >> b + c; // expected-warning {{operator '>>' has lower precedence than '+'; '+' will be evaluated first}} \
+ expected-note {{place parentheses around the '+' expression to silence this warning}}
+}
OpenPOWER on IntegriCloud