File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -2674,7 +2674,7 @@ void ASTDeclReader::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
2674
2674
2675
2675
D->setDeclaredWithTypename (Record.readInt ());
2676
2676
2677
- if (D->hasTypeConstraint ()) {
2677
+ if (Record. readBool () && D->hasTypeConstraint ()) {
2678
2678
ConceptReference *CR = nullptr ;
2679
2679
if (Record.readBool ())
2680
2680
CR = Record.readConceptReference ();
Original file line number Diff line number Diff line change @@ -1899,7 +1899,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
1899
1899
Record.push_back (D->wasDeclaredWithTypename ());
1900
1900
1901
1901
const TypeConstraint *TC = D->getTypeConstraint ();
1902
- assert (( bool ) TC == D-> hasTypeConstraint () );
1902
+ Record. push_back ( /* TypeConstraintInitialized= */ TC != nullptr );
1903
1903
if (TC) {
1904
1904
auto *CR = TC->getConceptReference ();
1905
1905
Record.push_back (CR != nullptr );
@@ -1917,7 +1917,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
1917
1917
if (OwnsDefaultArg)
1918
1918
Record.AddTemplateArgumentLoc (D->getDefaultArgument ());
1919
1919
1920
- if (!TC && !OwnsDefaultArg &&
1920
+ if (!D-> hasTypeConstraint () && !OwnsDefaultArg &&
1921
1921
D->getDeclContext () == D->getLexicalDeclContext () &&
1922
1922
!D->isInvalidDecl () && !D->hasAttrs () &&
1923
1923
!D->isTopLevelDeclInObjCContainer () && !D->isImplicit () &&
@@ -2580,6 +2580,7 @@ void ASTWriter::WriteDeclAbbrevs() {
2580
2580
// TemplateTypeParmDecl
2581
2581
Abv->Add (
2582
2582
BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 1 )); // wasDeclaredWithTypename
2583
+ Abv->Add (BitCodeAbbrevOp (0 )); // TypeConstraintInitialized
2583
2584
Abv->Add (BitCodeAbbrevOp (0 )); // OwnsDefaultArg
2584
2585
DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev (std::move (Abv));
2585
2586
Original file line number Diff line number Diff line change 1
- // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t
2
- // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s
3
-
4
- // expected-no-diagnostics
1
+ // RUN: %clang_cc1 -std=c++2a -fallow-pch-with-compiler-errors -emit-pch %s -o %t -verify
2
+ // RUN: %clang_cc1 -std=c++2a -fallow-pch-with-compiler-errors -include-pch %t %s -verify
5
3
6
4
#ifndef HEADER
7
5
#define HEADER
@@ -27,3 +25,12 @@ int main() {
27
25
}
28
26
29
27
#endif
28
+
29
+ namespace GH99036 {
30
+
31
+ template <typename T>
32
+ concept C; // expected-error {{expected '='}}
33
+ // expected-note@32 {{declared here}}
34
+ template <C U> void f (); // expected-error {{a concept definition cannot refer to itself}}
35
+
36
+ } // namespace GH99036
You can’t perform that action at this time.
0 commit comments