]> granicus.if.org Git - clang/commitdiff
Fix regression in r172376. Don't try to detect missing 'constexpr' specifiers
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 14 Jan 2013 08:00:39 +0000 (08:00 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 14 Jan 2013 08:00:39 +0000 (08:00 +0000)
on redeclarations, since that makes us pick wrong prior declarations under
some circumstances.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172384 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp

index cc9f4df4476bde0fa12c42b870f5f10b0a043352..d3d027b8a56bd058fdcb21ee921673c3fcc75525 100644 (file)
@@ -1038,8 +1038,7 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old,
     // 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;
index 559838b056f940b1d4a42a9c89628ea617c38d84..344f8ce8c48895fa78f290a96ddfb31e3c39c249 100644 (file)
@@ -5,6 +5,8 @@ using size_t = decltype(sizeof(int));
 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 @@ void f(const S &s) {
 
 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(); }