File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -2667,7 +2667,8 @@ void ASTDeclReader::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
26672667
26682668 D->setDeclaredWithTypename (Record.readInt ());
26692669
2670- if (D->hasTypeConstraint ()) {
2670+ const bool TypeConstraintInitialized = Record.readBool ();
2671+ if (TypeConstraintInitialized && D->hasTypeConstraint ()) {
26712672 ConceptReference *CR = nullptr ;
26722673 if (Record.readBool ())
26732674 CR = Record.readConceptReference ();
Original file line number Diff line number Diff line change @@ -1882,7 +1882,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
18821882 Record.push_back (D->wasDeclaredWithTypename ());
18831883
18841884 const TypeConstraint *TC = D->getTypeConstraint ();
1885- assert (( bool ) TC == D-> hasTypeConstraint () );
1885+ Record. push_back ( /* TypeConstraintInitialized= */ TC != nullptr );
18861886 if (TC) {
18871887 auto *CR = TC->getConceptReference ();
18881888 Record.push_back (CR != nullptr );
@@ -1900,7 +1900,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
19001900 if (OwnsDefaultArg)
19011901 Record.AddTemplateArgumentLoc (D->getDefaultArgument ());
19021902
1903- if (!TC && !OwnsDefaultArg &&
1903+ if (!D-> hasTypeConstraint () && !OwnsDefaultArg &&
19041904 D->getDeclContext () == D->getLexicalDeclContext () &&
19051905 !D->isInvalidDecl () && !D->hasAttrs () &&
19061906 !D->isTopLevelDeclInObjCContainer () && !D->isImplicit () &&
@@ -2563,6 +2563,7 @@ void ASTWriter::WriteDeclAbbrevs() {
25632563 // TemplateTypeParmDecl
25642564 Abv->Add (
25652565 BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 1 )); // wasDeclaredWithTypename
2566+ Abv->Add (BitCodeAbbrevOp (0 )); // TypeConstraintInitialized
25662567 Abv->Add (BitCodeAbbrevOp (0 )); // OwnsDefaultArg
25672568 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev (std::move (Abv));
25682569
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 -o %t %s -verify
2+ // RUN: %clang_cc1 -std=c++2a -fallow-pch-with-compiler-errors -include-pch %t %s -verify
53
64#ifndef HEADER
75#define HEADER
@@ -27,3 +25,12 @@ int main() {
2725}
2826
2927#endif
28+
29+ namespace GH99036 {
30+
31+ template <typename T>
32+ concept C; // expected-error {{expected '='}}
33+
34+ template <C U> void f (); // expected-error {{unknown type name 'C'}}
35+
36+ } // namespace GH99036
You can’t perform that action at this time.
0 commit comments