Always rebuild a DeclRefExpr if its FoundDecl would change.

Fixes a regression introduced by r369999.

llvm-svn: 373022
This commit is contained in:
Richard Smith 2019-09-26 22:28:32 +00:00
parent c898724974
commit bf322b7cdd
2 changed files with 17 additions and 0 deletions

View File

@ -9219,6 +9219,7 @@ TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
if (!getDerived().AlwaysRebuild() &&
QualifierLoc == E->getQualifierLoc() &&
ND == E->getDecl() &&
Found == E->getFoundDecl() &&
NameInfo.getName() == E->getDecl()->getDeclName() &&
!E->hasExplicitTemplateArgs()) {

View File

@ -0,0 +1,16 @@
// RUN: %clang_cc1 -std=c++2a -verify %s
// expected-no-diagnostics
namespace UsingInGenericLambda {
namespace a {
enum { b };
}
template<typename> void c() {
auto d = [](auto) {
using a::b;
(void)b;
};
d(0);
}
void e() { c<int>(); }
}