[PATCH] D120255: [Concepts] Check constraints for explicit template instantiations

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 2 11:58:02 PST 2022


royjacobson added inline comments.


================
Comment at: clang/test/SemaTemplate/constraints-instantiation.cpp:3-8
+// void PR46029::A<1>::f()
+// CHECK: define {{.*}} @_ZN7PR460291AILi1EE1fEv
+// void PR46029::A<2>::f()
+// CHECK: define {{.*}} @_ZN7PR460291AILi2EE1fEv
+// void PR46029::A<3>::f()
+// CHECK-NOT: define {{.*}} @_ZN7PR460291AILi3EE1fEv
----------------
aaron.ballman wrote:
> I think it might be better to test this via an `-ast-dump` test (which lives in the `AST` test directory) rather than emitting LLVM IR to determine whether something was instantiated or not.
> 
> Btw, when you convert the test to use `-ast-dump`, be sure to make use of regexes for things like line, column numbers, pointer values, etc so that the test is easier to edit without breaking.
I tried to look now into doing it in the ast-dump. It seems that we create a new `ClassTemplateSpecializationDecl` in SemaTemplate:9663 (`ActOnExplicitInstantiation`) that is copied from the parent `ClassTemplateDecl` along with all its members and `CXXMethodDecl`s. That means that the member functions with the unsatisfied constraints still appear in the AST.

Do you think I should add the constraints checks into the creation of `ClassTemplateSpecializationDecl` instead, so we don't create unnecessary `CXXMethodDecl`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120255/new/

https://reviews.llvm.org/D120255



More information about the cfe-commits mailing list