summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-12-21 22:26:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-12-21 22:26:47 +0000
commit5645be43c2a199fbb08ba2666210e3aa673062a1 (patch)
treea1249af57b2d74da3689192d681b3285bd2c5832 /test
parent4fafa79f2d3e20437fa61ae9ead9bf0c7311cd0e (diff)
Suppress "redundant parens" warning for "A (::B())".
This is a slightly odd construct (it's more common to see "A (::B)()") but can happen in friend declarations, and the parens are not redundant as they prevent the :: binding to the left. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Parser/cxx-decl.cpp16
-rw-r--r--test/SemaCXX/decl-expr-ambiguity.cpp17
2 files changed, 33 insertions, 0 deletions
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index 711a874f6a..58ad08079c 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -282,6 +282,22 @@ namespace NNS {
}
}
+inline namespace ParensAroundFriend { // expected-error 0-1{{C++11}}
+ struct A {};
+ struct B {
+ static A C();
+ };
+ namespace X {
+ struct B {};
+ struct D {
+ // No warning here: while this could be written as
+ // friend (::B::C)();
+ // we do need parentheses *somewhere* here.
+ friend A (::B::C());
+ };
+ }
+}
+
// PR8380
extern "" // expected-error {{unknown linkage language}}
test6a { ;// expected-error {{C++ requires a type specifier for all declarations}}
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index 1e31d701d0..b77e226b5d 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -125,3 +125,20 @@ void fizbin() {
baz b3; // expected-error {{must use 'class' tag to refer to type 'baz' in this scope}}
}
}
+
+namespace TemporaryFromFunctionCall {
+ struct A {
+ A(int);
+ };
+ int f();
+ int g(int);
+ namespace N {
+ void x() {
+ // FIXME: For the first and second of these (but not the third), we
+ // should produce a vexing-parse warning.
+ A(f());
+ A(g(int()));
+ A(g(int));
+ }
+ }
+}