summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-19 17:02:01 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-19 17:02:01 +0000
commitc0afc6760837d5760416f557305cd8a2c386a7b4 (patch)
treec6658a87dcdf883a1e472ae47c7da7085bbcf9e4
parent0d7e9538db379900e1e88d02982a4951106e447d (diff)
downloadbcm5719-llvm-c0afc6760837d5760416f557305cd8a2c386a7b4.tar.gz
bcm5719-llvm-c0afc6760837d5760416f557305cd8a2c386a7b4.zip
We don't actually need to check the implicit object argument's
conversion a second time for a conversion candidate (with the real acting context), because the only problems we would find are access or ambiguity issues that won't be diagnosed until we pick this candidate. Add a test case to prove it to myself. llvm-svn: 111526
-rw-r--r--clang/lib/Sema/SemaOverload.cpp15
-rw-r--r--clang/test/SemaCXX/conversion-function.cpp18
2 files changed, 18 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index f8f04defb1b..30979b78d33 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -3767,21 +3767,6 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
return;
}
- // Make sure that the actual object argument initialization will work, when
- // it comes down to it. This takes into account the actual acting context.
- if (ConversionContext->getCanonicalDecl()
- != ActingContext->getCanonicalDecl()) {
- ImplicitConversionSequence ObjectConvertICS
- = TryObjectArgumentInitialization(From->getType(), Conversion,
- ActingContext);
- if (ObjectConvertICS.isBad()) {
- Candidate.Viable = false;
- Candidate.FailureKind = ovl_fail_bad_conversion;
- Candidate.Conversions[0] = ObjectConvertICS;
- return;
- }
- }
-
// We won't go through a user-define type conversion function to convert a
// derived to base as such conversions are given Conversion Rank. They only
// go through a copy constructor. 13.3.3.1.2-p4 [over.ics.user]
diff --git a/clang/test/SemaCXX/conversion-function.cpp b/clang/test/SemaCXX/conversion-function.cpp
index 3d544ae03cf..07281e16d3f 100644
--- a/clang/test/SemaCXX/conversion-function.cpp
+++ b/clang/test/SemaCXX/conversion-function.cpp
@@ -306,4 +306,22 @@ namespace rdar8018274 {
void test2(UeberDerived ud) {
int i = ud; // expected-error{{ambiguous conversion from derived class 'rdar8018274::SuperDerived' to base class 'rdar8018274::Base'}}
}
+
+ struct Base2 {
+ operator int();
+ };
+
+ struct Base3 {
+ operator int();
+ };
+
+ struct Derived23 : Base2, Base3 {
+ using Base2::operator int;
+ };
+
+ struct ExtraDerived23 : Derived23 { };
+
+ void test3(ExtraDerived23 ed) {
+ int i = ed;
+ }
}
OpenPOWER on IntegriCloud