[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type
S. B. Tam via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun May 27 03:36:30 PDT 2018
cpplearner created this revision.
cpplearner added a reviewer: rsmith.
Herald added a subscriber: cfe-commits.
This will allow the following code:
struct base {};
using cbase = const base;
struct inherit : cbase {
using cbase::cbase; // previously error: 'cbase' (aka 'const base') is not a direct base of 'inherit', cannot inherit constructors
};
See https://stackoverflow.com/questions/50534219/inherit-from-const-type-passed-as-template-parameter
Repository:
rC Clang
https://reviews.llvm.org/D47419
Files:
lib/Sema/SemaDeclCXX.cpp
test/CXX/special/class.inhctor/elsewhere.cpp
Index: test/CXX/special/class.inhctor/elsewhere.cpp
===================================================================
--- test/CXX/special/class.inhctor/elsewhere.cpp
+++ test/CXX/special/class.inhctor/elsewhere.cpp
@@ -62,3 +62,4 @@
G(int &) : G(0) {}
};
G<B1> g(123);
+G<const B1> g2(123);
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9686,7 +9686,8 @@
QualType DesiredBase,
bool &AnyDependentBases) {
// Check whether the named type is a direct base class.
- CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified();
+ CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+ .getUnqualifiedType();
for (auto &Base : Derived->bases()) {
CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
if (CanonicalDesiredBase == BaseType)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47419.148744.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180527/67593a48/attachment-0001.bin>
More information about the cfe-commits
mailing list