forked from OSchip/llvm-project
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. llvm-svn: 172384
This commit is contained in:
parent
f55e719a13
commit
59b8e701d3
|
@ -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;
|
||||
|
|
|
@ -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(); }
|
||||
|
|
Loading…
Reference in New Issue