Index: clang/lib/Sema/SemaOverload.cpp =================================================================== --- clang/lib/Sema/SemaOverload.cpp +++ clang/lib/Sema/SemaOverload.cpp @@ -4984,12 +4984,12 @@ InOverloadResolution, AllowObjCWritebackConversion); } - // FIXME: Check the other conditions here: array of character type, - // initializer is a string literal. - if (ToType->isArrayType()) { + + if (ToType->isArrayType() && ToType->isCharType() && + isa(From->getInit(0))) { InitializedEntity Entity = - InitializedEntity::InitializeParameter(S.Context, ToType, - /*Consumed=*/false); + InitializedEntity::InitializeParameter(S.Context, ToType, + /*Consumed=*/false); if (S.CanPerformCopyInitialization(Entity, From)) { Result.setStandard(); Result.Standard.setAsIdentityConversion(); Index: clang/test/CXX/drs/dr14xx.cpp =================================================================== --- clang/test/CXX/drs/dr14xx.cpp +++ clang/test/CXX/drs/dr14xx.cpp @@ -334,6 +334,22 @@ X x; X x2{x}; + + void f1(int); + void f1(std::initializer_list); + void g1() { f1({42}); } + + template + struct Pair { + Pair(T, U); + }; + struct String { + String(const char *); + }; + + void f2(Pair); + void f2(std::initializer_list); + void g2() { f2({"foo", "bar"}); } } // dr_example namespace nonaggregate { @@ -379,6 +395,31 @@ struct Value { Value(Pair); Value(TwoPairs); }; void f() { Value{{{1,2},{3,4}}}; } } + namespace NonAmbiguous { + // The original implementation made this case ambigious due to the special + // handling of one element initialization lists. + void f(int(&&)[1]); + void f(unsigned(&&)[1]); + + void g(unsigned i) { + f({i}); + } + } // namespace NonAmbiguous + +#if __cplusplus >= 201103L + namespace StringLiterals { + void f(const char[4]); + void f(const wchar_t[4]); + void f(const char16_t[4]); + void f(const char32_t[4]); + void g() { + f({"abc"}); // expected-warning {{braces around scalar initializer}} + f({L"abc"}); // expected-warning {{braces around scalar initializer}} + f({uR"(abc)"}); // expected-warning {{braces around scalar initializer}} + f({UR"(abc)"}); // expected-warning {{braces around scalar initializer}} + } + } // namespace StringLiterals +#endif } // dr1467 namespace dr1490 { // dr1490: 3.7 c++11