diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-04-13 15:07:45 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-04-13 15:07:45 +0000 |
| commit | 538be4622c4699a2821a134332a65b04b94fba3f (patch) | |
| tree | 30d48a4c6a6f4ca635e67d0855a466f59af917c7 /clang/lib/Sema/SemaDeclCXX.cpp | |
| parent | 5d8eb779d5e28f1924741ea68ae96f4c32d31fe7 (diff) | |
| download | bcm5719-llvm-538be4622c4699a2821a134332a65b04b94fba3f.tar.gz bcm5719-llvm-538be4622c4699a2821a134332a65b04b94fba3f.zip | |
During referencing binding, only consider conversion functions for
direct reference binding when the source and target types are not
reference-related. Fixes PR6066.
llvm-svn: 101132
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 46ed857a9e4..cc83e65b36a 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4577,14 +4577,16 @@ Sema::CheckReferenceInit(Expr *&Init, QualType DeclType, } } - // -- has a class type (i.e., T2 is a class type) and can be - // implicitly converted to an lvalue of type "cv3 T3," - // where "cv1 T1" is reference-compatible with "cv3 T3" - // 92) (this conversion is selected by enumerating the - // applicable conversion functions (13.3.1.6) and choosing - // the best one through overload resolution (13.3)), + // -- has a class type (i.e., T2 is a class type), where T1 is + // not reference-related to T2, and can be implicitly + // converted to an lvalue of type "cv3 T3," where "cv1 T1" + // is reference-compatible with "cv3 T3" 92) (this + // conversion is selected by enumerating the applicable + // conversion functions (13.3.1.6) and choosing the best + // one through overload resolution (13.3)), if (!isRValRef && !SuppressUserConversions && T2->isRecordType() && - !RequireCompleteType(DeclLoc, T2, 0)) { + !RequireCompleteType(DeclLoc, T2, 0) && + RefRelationship == Ref_Incompatible) { CXXRecordDecl *T2RecordDecl = dyn_cast<CXXRecordDecl>(T2->getAs<RecordType>()->getDecl()); |

