[PATCH] D126907: Deferred Concept Instantiation Implementation Take 2

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 22:57:29 PDT 2022

ChuanqiXu added a comment.

Great progress!

In D126907#3599835 <https://reviews.llvm.org/D126907#3599835>, @erichkeane wrote:

> Note that the failure comes down to:
>   template<typename T> concept C = T::f();
>   template<template<C> class P> struct S1{};
>   template<C> struct X{};
>   S1<X> s11;
> and requires the -frelaxed-template-template-args flag:
>   [ekeane1 at scsel-clx-24 build]$  ./bin/clang -cc1 -std=c++20 temp.cpp -frelaxed-template-template-args
>   temp.cpp:5:4: error: template template argument 'X' is more constrained than template template parameter 'P'
>   S1<X> s11;
>      ^
>   temp.cpp:3:29: note: 'P' declared here
>   template <template<C> class P> struct S1{};
>                               ^
>   temp.cpp:4:20: note: 'X' declared here
>   template<C> struct X{};
>                      ^
>   1 error generated.

As far as I could tell, we could omit the diagnostic by deleting https://github.com/llvm/llvm-project/blob/bc74bca5363270e987c2e3c263bfaaeb6ceab66f/clang/include/clang/Sema/SemaConcept.h#L45-L53

This change is obsolutely wrong but it shows the bug comes from `ParameterMapping` so we could locate https://github.com/llvm/llvm-project/blob/bc74bca5363270e987c2e3c263bfaaeb6ceab66f/clang/lib/Sema/SemaConcept.cpp#L723 further.

Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:2461
         // substitution)
-        if (SubstTypeConstraint(Inst, TC, TemplateArgs))
+        if (SubstTypeConstraint(Inst, TC, TemplateArgs, false))
           return nullptr;

Comment at: clang/test/Driver/crash-report.cpp:28
+// RUNX: cat %t/crash-report-*.cpp | FileCheck --check-prefix=CHECKSRC %s
+// RUNX: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s
What's the meaning of RUNX?



More information about the cfe-commits mailing list