summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-02-01 22:06:02 +0000
committerEric Fiselier <eric@efcs.ca>2019-02-01 22:06:02 +0000
commit1147f71fed863639e3695a8be6979c39397d88b6 (patch)
treefa7d7f4ad57310891cadad2ea809660f0623975c /clang/test
parent2e719bc428d27345da7cdcfa634c03ec69f31474 (diff)
downloadbcm5719-llvm-1147f71fed863639e3695a8be6979c39397d88b6.tar.gz
bcm5719-llvm-1147f71fed863639e3695a8be6979c39397d88b6.zip
Improve diagnostic to tell you a type is incomplete.
I recently ran into this code: ``` \#include <iostream> void foo(const std::string &s, const std::string& = ""); \#include <string> void test() { foo(""); } ``` The diagnostic produced said it can't bind char[1] to std::string const&. It didn't mention std::string is incomplete. The user had to infer that. This patch causes the diagnostic to now say "incomplete type". llvm-svn: 352927
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp2
-rw-r--r--clang/test/SemaCXX/decl-init-ref.cpp9
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
index f371891e548..9a82ec4a7bd 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -327,7 +327,7 @@ namespace update_rbrace_loc_crash {
struct A {};
template <typename T, typename F, int... I>
std::initializer_list<T> ExplodeImpl(F p1, A<int, I...>) {
- // expected-error@+1 {{reference to type 'const update_rbrace_loc_crash::Incomplete' could not bind to an rvalue of type 'void'}}
+ // expected-error@+1 {{reference to incomplete type 'const update_rbrace_loc_crash::Incomplete' could not bind to an rvalue of type 'void'}}
return {p1(I)...};
}
template <typename T, int N, typename F>
diff --git a/clang/test/SemaCXX/decl-init-ref.cpp b/clang/test/SemaCXX/decl-init-ref.cpp
index 42b9286852c..fb5ca8c1491 100644
--- a/clang/test/SemaCXX/decl-init-ref.cpp
+++ b/clang/test/SemaCXX/decl-init-ref.cpp
@@ -36,3 +36,12 @@ namespace PR16502 {
int f();
const A &c = { 10, ++c.temporary };
}
+
+namespace IncompleteTest {
+ struct String;
+ // expected-error@+1 {{reference to incomplete type 'const IncompleteTest::String' could not bind to an lvalue of type 'const char [1]'}}
+ void takeString(const String& = "") {} // expected-note {{passing argument to parameter here}} expected-note {{candidate function}}
+ void test() {
+ takeString(); // expected-error {{no matching function for call}}
+ }
+}
OpenPOWER on IntegriCloud