summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-06 09:03:20 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-06 09:03:20 +0000
commitd99609ae48ac1c440173e6d69cddca09c12c293d (patch)
tree65b96b67cf64df998292e13314cf724047a05e8c /clang/lib
parent92db8e8e392757768b58950a6b92bd1be0d358b7 (diff)
downloadbcm5719-llvm-d99609ae48ac1c440173e6d69cddca09c12c293d.tar.gz
bcm5719-llvm-d99609ae48ac1c440173e6d69cddca09c12c293d.zip
When performing template argument deduction for a non-reference
conversion function when we're binding the result to a reference, drop cv-qualifiers on the type we're referring to, since we should be deducing a type that can be adjusted (via cv-qualification) to the requested type. Fixes PR9336, and the remaining Boost.Assign failure. llvm-svn: 127117
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 43cbd62a635..c30c8a06162 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -2845,18 +2845,18 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
QualType P = Context.getCanonicalType(FromType);
QualType A = Context.getCanonicalType(ToType);
- // C++0x [temp.deduct.conv]p3:
+ // C++0x [temp.deduct.conv]p2:
// If P is a reference type, the type referred to by P is used for
// type deduction.
if (const ReferenceType *PRef = P->getAs<ReferenceType>())
P = PRef->getPointeeType();
- // C++0x [temp.deduct.conv]p3:
- // If A is a reference type, the type referred to by A is used
+ // C++0x [temp.deduct.conv]p4:
+ // [...] If A is a reference type, the type referred to by A is used
// for type deduction.
if (const ReferenceType *ARef = A->getAs<ReferenceType>())
- A = ARef->getPointeeType();
- // C++ [temp.deduct.conv]p2:
+ A = ARef->getPointeeType().getUnqualifiedType();
+ // C++ [temp.deduct.conv]p3:
//
// If A is not a reference type:
else {
@@ -2877,9 +2877,10 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *FunctionTemplate,
else
P = P.getUnqualifiedType();
- // C++0x [temp.deduct.conv]p3:
+ // C++0x [temp.deduct.conv]p4:
// If A is a cv-qualified type, the top level cv-qualifiers of A's
- // type are ignored for type deduction.
+ // type are ignored for type deduction. If A is a reference type, the type
+ // referred to by A is used for type deduction.
A = A.getUnqualifiedType();
}
OpenPOWER on IntegriCloud