PR15966: don't get confused by a complex integer -> complex integer conversion

and misclassify it as a complex-real conversion.

llvm-svn: 181626
This commit is contained in:
Richard Smith 2013-05-10 20:29:50 +00:00
parent 300f0b966c
commit b8a98241fc
2 changed files with 10 additions and 4 deletions

View File

@ -1591,7 +1591,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
// Integral conversions (C++ 4.7).
SCS.Second = ICK_Integral_Conversion;
FromType = ToType.getUnqualifiedType();
} else if (FromType->isAnyComplexType() && ToType->isComplexType()) {
} else if (FromType->isAnyComplexType() && ToType->isAnyComplexType()) {
// Complex conversions (C99 6.3.1.6)
SCS.Second = ICK_Complex_Conversion;
FromType = ToType.getUnqualifiedType();

View File

@ -42,9 +42,15 @@ void test_promote_or_convert2(float _Complex fc) {
int *cp = promote_or_convert2(fc);
}
char *promote_or_convert3(int _Complex);
int *promote_or_convert3(long _Complex);
char *promote_or_convert3(int _Complex); // expected-note {{candidate}}
int *promote_or_convert3(long _Complex); // expected-note {{candidate}}
void test_promote_or_convert3(short _Complex sc) {
char *cp = promote_or_convert3(sc);
char *cp1 = promote_or_convert3(sc);
char *cp2 = promote_or_convert3(1i);
int *cp3 = promote_or_convert3(1il);
int *cp4 = promote_or_convert3(1ill); // expected-error {{ambiguous}}
}
char &convert4(short _Complex);
char &test_convert4 = convert4(1i);