[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2019-08-17 Thread S. B. Tam via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369196: [SemaDeclCXX] Allow inheriting constructor 
declaration to specify a cv… (authored by cpplearner, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47419?vs=148744=215753#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47419/new/

https://reviews.llvm.org/D47419

Files:
  cfe/trunk/lib/Sema/SemaDeclCXX.cpp
  cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp


Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -9997,7 +9997,8 @@
 QualType DesiredBase,
 bool ) {
   // Check whether the named type is a direct base class.
-  CanQualType CanonicalDesiredBase = 
DesiredBase->getCanonicalTypeUnqualified();
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {
 CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
 if (CanonicalDesiredBase == BaseType)
Index: cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
===
--- cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
+++ cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
@@ -62,3 +62,4 @@
   G(int &) : G(0) {}
 };
 G g(123);
+G g2(123);


Index: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp
@@ -9997,7 +9997,8 @@
 QualType DesiredBase,
 bool ) {
   // Check whether the named type is a direct base class.
-  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified();
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {
 CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
 if (CanonicalDesiredBase == BaseType)
Index: cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
===
--- cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
+++ cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp
@@ -62,3 +62,4 @@
   G(int &) : G(0) {}
 };
 G g(123);
+G g2(123);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2019-08-12 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added inline comments.
This revision is now accepted and ready to land.



Comment at: lib/Sema/SemaDeclCXX.cpp:9690
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {

cpplearner wrote:
> rsmith wrote:
> > How are we getting a qualified type here? Is this actually a bug in 
> > `getCanonicalTypeUnqualified`?
> It seems that `getCanonicalTypeUnqualified` does not strip qualifiers from 
> the canonical type. I guess "Unqualified" here just means the method does not 
> include local qualifiers, unlike QualType::getCanonicalType.
> 
> Thus, in the case of `using cbase = const base;`, 
> `getCanonicalTypeUnqualified` will return the canonical type of `cbase` as 
> is, which is `const base`, a const-qualified type.
Maybe we should have a method that promises to return an unqualified type.

This change seems reasonable overall.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47419/new/

https://reviews.llvm.org/D47419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2019-08-12 Thread S. B. Tam via Phabricator via cfe-commits
cpplearner added a comment.
Herald added a project: clang.

ping


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D47419/new/

https://reviews.llvm.org/D47419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2018-05-30 Thread S. B. Tam via Phabricator via cfe-commits
cpplearner added inline comments.



Comment at: lib/Sema/SemaDeclCXX.cpp:9690
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {

rsmith wrote:
> How are we getting a qualified type here? Is this actually a bug in 
> `getCanonicalTypeUnqualified`?
It seems that `getCanonicalTypeUnqualified` does not strip qualifiers from the 
canonical type. I guess "Unqualified" here just means the method does not 
include local qualifiers, unlike QualType::getCanonicalType.

Thus, in the case of `using cbase = const base;`, `getCanonicalTypeUnqualified` 
will return the canonical type of `cbase` as is, which is `const base`, a 
const-qualified type.


Repository:
  rC Clang

https://reviews.llvm.org/D47419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2018-05-27 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: lib/Sema/SemaDeclCXX.cpp:9690
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {

How are we getting a qualified type here? Is this actually a bug in 
`getCanonicalTypeUnqualified`?


Repository:
  rC Clang

https://reviews.llvm.org/D47419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2018-05-27 Thread Rustam Abdullaev via Phabricator via cfe-commits
rustam added a comment.

I believe this fixed the bug #37600 



Repository:
  rC Clang

https://reviews.llvm.org/D47419



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D47419: [SemaDeclCXX] Allow inheriting constructor declaration that specify a cv-qualified type

2018-05-27 Thread S. B. Tam via Phabricator via cfe-commits
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 g(123);
+G g2(123);
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9686,7 +9686,8 @@
 QualType DesiredBase,
 bool ) {
   // Check whether the named type is a direct base class.
-  CanQualType CanonicalDesiredBase = 
DesiredBase->getCanonicalTypeUnqualified();
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {
 CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
 if (CanonicalDesiredBase == BaseType)


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 g(123);
+G g2(123);
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -9686,7 +9686,8 @@
 QualType DesiredBase,
 bool ) {
   // Check whether the named type is a direct base class.
-  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified();
+  CanQualType CanonicalDesiredBase = DesiredBase->getCanonicalTypeUnqualified()
+.getUnqualifiedType();
   for (auto  : Derived->bases()) {
 CanQualType BaseType = Base.getType()->getCanonicalTypeUnqualified();
 if (CanonicalDesiredBase == BaseType)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits