Skip to content

Commit fba48b8

Browse files
author
huqizhi
committed
[Clang][Sema] Fix a bug on type constraint checking
1 parent 35b7843 commit fba48b8

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ Bug Fixes in This Version
259259
operator.
260260
Fixes (#GH83267).
261261

262+
- Fix a bug on type constraint checking (#GH84368).
263+
262264
Bug Fixes to Compiler Builtins
263265
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
264266

clang/lib/Sema/SemaTemplateInstantiateDecl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) {
16981698
assert(!Owner->isDependentContext());
16991699
Inst->setLexicalDeclContext(Owner);
17001700
RecordInst->setLexicalDeclContext(Owner);
1701+
Inst->setObjectOfFriendDecl();
17011702

17021703
if (PrevClassTemplate) {
17031704
Inst->setCommonPtr(PrevClassTemplate->getCommonPtr());

clang/test/Sema/PR84368.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clang_cc1 -std=c++20 -verify %s
2+
// RUN: %clang_cc1 -std=c++23 -verify %s
3+
// expected-no-diagnostics
4+
5+
template<class T> concept IsOk = requires() { typename T::Float; };
6+
7+
template<IsOk T> struct Thing;
8+
9+
template<IsOk T> struct Foobar {
10+
template<int> struct Inner {
11+
template<IsOk T2> friend struct Thing;
12+
};
13+
};
14+
15+
struct MyType { using Float=float; };
16+
Foobar<MyType>::Inner<0> foobar;

0 commit comments

Comments
 (0)