Add some text from the C++ standard and additional ambiguity resolution tests.
No funcitonality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57136 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/decl-expr-ambiguity.cpp b/test/SemaCXX/decl-expr-ambiguity.cpp
index 35805ab..3459d77 100644
--- a/test/SemaCXX/decl-expr-ambiguity.cpp
+++ b/test/SemaCXX/decl-expr-ambiguity.cpp
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -verify -pedantic-errors %s
void f() {
int a;
@@ -14,7 +14,12 @@
if (int(a)+1) {}
for (int(a)+1;;) {}
a = sizeof(int()+1);
+ a = sizeof(int(1));
typeof(int()+1) a2;
+ (int(1)); // expected-warning {{expression result unused}}
+
+ // type-id
+ (int())1; // expected-error {{used type 'int ()' where arithmetic or pointer type is required}}
// Declarations.
T(*d)(int(p)); // expected-warning {{statement was disambiguated as declaration}} expected-error {{previous definition is here}}
@@ -25,3 +30,13 @@
if (int(a)=1) {}
int(d3(int())); // expected-warning {{statement was disambiguated as declaration}}
}
+
+class C { };
+void fn(int(C)) { } // void fn(int(*fp)(C c)) { }
+ // not: void fn(int C);
+int g(C);
+
+void foo() {
+ fn(1); // expected-error {{incompatible integer to pointer conversion passing 'int', expected 'int (*)(class C)'}}
+ fn(g); // OK
+}