Con != ConEnd; ++Con) {
NamedDecl *D = *Con;
DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
- bool SuppressUserConversions = false;
// Find the constructor (which may be a template).
CXXConstructorDecl *Constructor = 0;
if (ConstructorTmpl)
Constructor = cast<CXXConstructorDecl>(
ConstructorTmpl->getTemplatedDecl());
- else {
+ else
Constructor = cast<CXXConstructorDecl>(D);
-
- // If we're performing copy initialization using a copy constructor,
- // we suppress user-defined conversions on the arguments.
- // FIXME: Move constructors?
- if (Kind.getKind() == InitializationKind::IK_Copy &&
- Constructor->isCopyConstructor())
- SuppressUserConversions = true;
-
- }
if (!Constructor->isInvalidDecl() &&
Constructor->isConvertingConstructor(AllowExplicit)) {
S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
/*ExplicitArgs*/ 0,
&Initializer, 1, CandidateSet,
- SuppressUserConversions);
+ /*SuppressUserConversions=*/true);
else
S.AddOverloadCandidate(Constructor, FoundDecl,
&Initializer, 1, CandidateSet,
- SuppressUserConversions);
+ /*SuppressUserConversions=*/true);
}
}
}
}
namespace PR6595 {
+ struct OtherString {
+ OtherString();
+ OtherString(const char*);
+ };
+
struct String {
String(const char *);
+ String(const OtherString&);
operator const char*() const;
};
- void f(bool Cond, String S) {
+ void f(bool Cond, String S, OtherString OS) {
(void)(Cond? S : "");
(void)(Cond? "" : S);
const char a[1] = {'a'};
(void)(Cond? S : a);
(void)(Cond? a : S);
+ (void)(Cond? OS : S);
}
}