[cfe-commits] r172384 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp

Richard Smith richard-llvm at metafoo.co.uk
Mon Jan 14 00:00:39 PST 2013


Author: rsmith
Date: Mon Jan 14 02:00:39 2013
New Revision: 172384

URL: http://llvm.org/viewvc/llvm-project?rev=172384&view=rev
Log:
Fix regression in r172376. Don't try to detect missing 'constexpr' specifiers
on redeclarations, since that makes us pick wrong prior declarations under
some circumstances.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=172384&r1=172383&r2=172384&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Jan 14 02:00:39 2013
@@ -1038,8 +1038,7 @@
     // or non-static member function). Add it now, on the assumption that this
     // is a redeclaration of OldMethod.
     unsigned NewQuals = NewMethod->getTypeQualifiers();
-    if ((OldMethod->isConstexpr() || NewMethod->isConstexpr()) &&
-        !isa<CXXConstructorDecl>(NewMethod))
+    if (NewMethod->isConstexpr() && !isa<CXXConstructorDecl>(NewMethod))
       NewQuals |= Qualifiers::Const;
     if (OldMethod->getTypeQualifiers() != NewQuals)
       return true;

Modified: cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp?rev=172384&r1=172383&r2=172384&view=diff
==============================================================================
--- cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp (original)
+++ cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp Mon Jan 14 02:00:39 2013
@@ -5,6 +5,8 @@
 struct S {
   constexpr int f();
   constexpr int g() const;
+  constexpr int h();
+  int h();
   static constexpr int Sf();
   /*static*/ constexpr void *operator new(size_t) noexcept;
   template<typename T> constexpr T tm();
@@ -25,6 +27,8 @@
 
 constexpr int S::f() const { return 0; }
 constexpr int S::g() { return 1; }
+constexpr int S::h() { return 0; }
+int S::h() { return 0; }
 constexpr int S::Sf() { return 2; }
 constexpr void *S::operator new(size_t) noexcept { return 0; }
 template<typename T> constexpr T S::tm() { return T(); }





More information about the cfe-commits mailing list