Skip to content

Commit ba2dff0

Browse files
committed
Revert "PR47792: Include the type of a pointer or reference non-type template"
This reverts commit 849c605 because it results in a stage 2 build failure: llvm-project/clang/include/clang/AST/ExternalASTSource.h:409:20: error: definition with same mangled name '_ZN5clang25LazyGenerationalUpdatePtrIPKNS_4DeclEPS1_XadL_ZNS_17ExternalASTSource19CompleteRedeclChainES3_EEE9makeValueERKNS_10ASTContextES4_' as another definition static ValueType makeValue(const ASTContext &Ctx, T Value);
1 parent 6f7e1ce commit ba2dff0

File tree

3 files changed

+3
-25
lines changed

3 files changed

+3
-25
lines changed

clang/lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5890,7 +5890,7 @@ ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) const {
58905890

58915891
case TemplateArgument::Declaration: {
58925892
auto *D = cast<ValueDecl>(Arg.getAsDecl()->getCanonicalDecl());
5893-
return TemplateArgument(D, getCanonicalType(Arg.getParamTypeForDecl()));
5893+
return TemplateArgument(D, Arg.getParamTypeForDecl());
58945894
}
58955895

58965896
case TemplateArgument::NullPtr:

clang/lib/AST/TemplateBase.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ void TemplateArgument::Profile(llvm::FoldingSetNodeID &ID,
244244
break;
245245

246246
case Declaration:
247-
ID.AddPointer(getAsDecl() ? getAsDecl()->getCanonicalDecl() : nullptr);
248-
getParamTypeForDecl().Profile(ID);
247+
ID.AddPointer(getAsDecl()? getAsDecl()->getCanonicalDecl() : nullptr);
249248
break;
250249

251250
case Template:
@@ -295,8 +294,7 @@ bool TemplateArgument::structurallyEquals(const TemplateArgument &Other) const {
295294
return TypeOrValue.V == Other.TypeOrValue.V;
296295

297296
case Declaration:
298-
return getAsDecl() == Other.getAsDecl() &&
299-
getParamTypeForDecl() == Other.getParamTypeForDecl();
297+
return getAsDecl() == Other.getAsDecl();
300298

301299
case Integral:
302300
return getIntegralType() == Other.getIntegralType() &&

clang/test/SemaTemplate/temp_arg_nontype_cxx1z.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -459,23 +459,3 @@ namespace PR46637 {
459459
X<f> y;
460460
int n = y.call(); // expected-error {{cannot initialize a variable of type 'int' with an rvalue of type 'void *'}}
461461
}
462-
463-
namespace PR47792 {
464-
using I = int;
465-
466-
template<decltype(auto)> int a;
467-
const int n = 0;
468-
const I n2 = 0;
469-
static_assert(&a<n> == &a<0>, "both should have type 'int'");
470-
static_assert(&a<n2> == &a<0>, "both should have type 'int'");
471-
472-
// FIXME: We will need to mangle these cases differently too!
473-
int m;
474-
const int &r1 = m;
475-
int &r2 = m;
476-
static_assert(&a<r1> != &a<r2>, "should have different types");
477-
478-
const I &r3 = m;
479-
static_assert(&a<r1> == &a<r3>, "should have different types");
480-
static_assert(&a<r2> != &a<r3>, "should have different types");
481-
}

0 commit comments

Comments
 (0)