Skip to content

Commit c26365e

Browse files
committed
[Clang][Sema] ASTContext::getUnconstrainedType propagates dependence
1 parent 7d81062 commit c26365e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ Bug Fixes to C++ Support
723723
- Clang now ignores template parameters only used within the exception specification of candidate function
724724
templates during partial ordering when deducing template arguments from a function declaration or when
725725
taking the address of a function template.
726+
- Fix a bug with checking constrained non-type template parameters for equivalence.
726727

727728
Bug Fixes to AST Handling
728729
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5910,7 +5910,8 @@ QualType ASTContext::getUnconstrainedType(QualType T) const {
59105910
if (auto *AT = CanonT->getAs<AutoType>()) {
59115911
if (!AT->isConstrained())
59125912
return T;
5913-
return getQualifiedType(getAutoType(QualType(), AT->getKeyword(), false,
5913+
return getQualifiedType(getAutoType(QualType(), AT->getKeyword(),
5914+
AT->isDependentType(),
59145915
AT->containsUnexpandedParameterPack()),
59155916
T.getQualifiers());
59165917
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2+
// expected-no-diagnostics
3+
4+
template<typename T>
5+
concept C = sizeof(T) == sizeof(int);
6+
7+
template<auto N>
8+
struct A;
9+
10+
template<C auto N>
11+
struct A<N>;

0 commit comments

Comments
 (0)