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) {
2667
2667
2668
2668
D->setDeclaredWithTypename (Record.readInt ());
2669
2669
2670
- if (D->hasTypeConstraint ()) {
2670
+ const bool TypeConstraintInitialized = Record.readBool ();
2671
+ if (TypeConstraintInitialized && D->hasTypeConstraint ()) {
2671
2672
ConceptReference *CR = nullptr ;
2672
2673
if (Record.readBool ())
2673
2674
CR = Record.readConceptReference ();
Original file line number Diff line number Diff line change @@ -1882,7 +1882,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
1882
1882
Record.push_back (D->wasDeclaredWithTypename ());
1883
1883
1884
1884
const TypeConstraint *TC = D->getTypeConstraint ();
1885
- assert (( bool ) TC == D-> hasTypeConstraint () );
1885
+ Record. push_back ( /* TypeConstraintInitialized= */ TC != nullptr );
1886
1886
if (TC) {
1887
1887
auto *CR = TC->getConceptReference ();
1888
1888
Record.push_back (CR != nullptr );
@@ -1900,7 +1900,7 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
1900
1900
if (OwnsDefaultArg)
1901
1901
Record.AddTemplateArgumentLoc (D->getDefaultArgument ());
1902
1902
1903
- if (!TC && !OwnsDefaultArg &&
1903
+ if (!D-> hasTypeConstraint () && !OwnsDefaultArg &&
1904
1904
D->getDeclContext () == D->getLexicalDeclContext () &&
1905
1905
!D->isInvalidDecl () && !D->hasAttrs () &&
1906
1906
!D->isTopLevelDeclInObjCContainer () && !D->isImplicit () &&
@@ -2563,6 +2563,7 @@ void ASTWriter::WriteDeclAbbrevs() {
2563
2563
// TemplateTypeParmDecl
2564
2564
Abv->Add (
2565
2565
BitCodeAbbrevOp (BitCodeAbbrevOp::Fixed, 1 )); // wasDeclaredWithTypename
2566
+ Abv->Add (BitCodeAbbrevOp (0 )); // TypeConstraintInitialized
2566
2567
Abv->Add (BitCodeAbbrevOp (0 )); // OwnsDefaultArg
2567
2568
DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev (std::move (Abv));
2568
2569
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
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
+
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