Re: [PATCH] D24884: Fix PR30274

2016-09-24 Thread Alex Lorenz via cfe-commits
arphaman abandoned this revision.
arphaman added a comment.

I just noticed that PR 30274 is actually a duplicate of PR 29087, which already 
has a patch with a fix in review. This patch is now abandoned. Sorry about not 
noticing the duplicate earlier.


Repository:
  rL LLVM

https://reviews.llvm.org/D24884



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


Re: [PATCH] D24884: Fix PR30274

2016-09-23 Thread Alex Lorenz via cfe-commits
arphaman added a comment.

(Forgot to mention) This is a a fix for the regression introduced by r274049.


Repository:
  rL LLVM

https://reviews.llvm.org/D24884



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


[PATCH] D24884: Fix PR30274

2016-09-23 Thread Alex Lorenz via cfe-commits
arphaman created this revision.
arphaman added a reviewer: rsmith.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.

This fixes PR 30274 by making sure that we skip the 'Using' and 
'ConstructorUsingShadowDecl' declarations when evaluating the 
'__has_nothrow_constructor' trait for a C++ type.

Repository:
  rL LLVM

https://reviews.llvm.org/D24884

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/PR30274-inherited-constructor-has-nothrow.cpp

Index: test/SemaCXX/PR30274-inherited-constructor-has-nothrow.cpp
===
--- /dev/null
+++ test/SemaCXX/PR30274-inherited-constructor-has-nothrow.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// expected-no-diagnostics
+
+struct Base {
+Base(int a) : i(a) {}
+int i;
+};
+
+struct Derived : Base {
+using Base::Base;
+};
+
+int foo() {
+   return __has_nothrow_constructor(Derived);
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4258,7 +4258,10 @@
   bool FoundConstructor = false;
   for (const auto *ND : Self.LookupConstructors(RD)) {
 // FIXME: In C++0x, a constructor template can be a default 
constructor.
-if (isa(ND))
+// Skip the inherited constructors as we are only interested in default
+// constructors which can't be inherited.
+if (isa(ND) || isa(ND) ||
+isa(ND))
   continue;
 const CXXConstructorDecl *Constructor = cast(ND);
 if (Constructor->isDefaultConstructor()) {


Index: test/SemaCXX/PR30274-inherited-constructor-has-nothrow.cpp
===
--- /dev/null
+++ test/SemaCXX/PR30274-inherited-constructor-has-nothrow.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// expected-no-diagnostics
+
+struct Base {
+Base(int a) : i(a) {}
+int i;
+};
+
+struct Derived : Base {
+using Base::Base;
+};
+
+int foo() {
+   return __has_nothrow_constructor(Derived);
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4258,7 +4258,10 @@
   bool FoundConstructor = false;
   for (const auto *ND : Self.LookupConstructors(RD)) {
 // FIXME: In C++0x, a constructor template can be a default constructor.
-if (isa(ND))
+// Skip the inherited constructors as we are only interested in default
+// constructors which can't be inherited.
+if (isa(ND) || isa(ND) ||
+isa(ND))
   continue;
 const CXXConstructorDecl *Constructor = cast(ND);
 if (Constructor->isDefaultConstructor()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits