summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-01-05 23:02:44 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-01-05 23:02:44 +0000
commitc92d206ce441934a28e5886b5d635748f865a808 (patch)
treecc70df83508f88b410b563f53fa0f68b90e797ad /clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
parent1594e0629d02a4a5c7598da6b5bb2a2bfef4207e (diff)
downloadbcm5719-llvm-c92d206ce441934a28e5886b5d635748f865a808.tar.gz
bcm5719-llvm-c92d206ce441934a28e5886b5d635748f865a808.zip
Add missing "original call argument has same type as deduced parameter type"
check for deductions from elements of a braced-init-list. llvm-svn: 291190
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
index 75c6734bce3..01d498a5e95 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -105,6 +105,7 @@ T deduce_ref(const std::initializer_list<T>&); // expected-note {{conflicting ty
template<typename T, typename U> struct pair { pair(...); };
template<typename T> void deduce_pairs(std::initializer_list<pair<T, typename T::type>>);
+// expected-note@-1 {{deduced type 'pair<[...], typename WithIntType::type>' of element of 1st parameter does not match adjusted type 'pair<[...], float>' of element of argument [with T = WithIntType]}}
struct WithIntType { typedef int type; };
template<typename ...T> void deduce_after_init_list_in_pack(void (*)(T...), T...); // expected-note {{<int, int> vs. <(no value), double>}}
@@ -123,7 +124,7 @@ void argument_deduction() {
pair<WithIntType, int> pi;
pair<WithIntType, float> pf;
deduce_pairs({pi, pi, pi}); // ok
- deduce_pairs({pi, pf, pi}); // FIXME: This should be rejected, as we fail to produce a type that exactly matches the argument type.
+ deduce_pairs({pi, pf, pi}); // expected-error {{no matching function}}
deduce_after_init_list_in_pack((void(*)(int,int))0, {}, 0);
deduce_after_init_list_in_pack((void(*)(int,int))0, {}, 0.0); // expected-error {{no matching function}}
@@ -298,9 +299,18 @@ namespace TemporaryInitListSourceRange_PR22367 {
namespace ParameterPackNestedInitializerLists_PR23904c3 {
template <typename ...T>
- void f(std::initializer_list<std::initializer_list<T>> ...tt);
+ void f(std::initializer_list<std::initializer_list<T>> ...tt); // expected-note 2{{conflicting}} expected-note {{incomplete pack}}
- void foo() { f({{0}}, {{'\0'}}); }
+ void foo() {
+ f({{0}}, {{'\0'}}); // ok, T = <int, char>
+ f({{0}, {'\0'}}); // expected-error {{no match}}
+ f({{0, '\0'}}); // expected-error {{no match}}
+
+ f({{0}}, {{{}}}); // expected-error {{no match}}
+ f({{0}}, {{{}, '\0'}}); // ok, T = <int, char>
+ f({{0}, {{}}}); // ok, T = <int>
+ f({{0, {}}}); // ok, T = <int>
+ }
}
namespace update_rbrace_loc_crash {
OpenPOWER on IntegriCloud