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

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 1 14:43:44 PST 2022


royjacobson added a comment.

In D120255#3352755 <https://reviews.llvm.org/D120255#3352755>, @erichkeane wrote:

> Hmm... doing FileCheck in a Sema test is highly irregular.  I would expect us to be able to test this in the type system in some way.  Something like `A<3>::f()` is invalid (see -verify).
>
> Also, please add all the context (as requested above!) with the -U9999 stuff.

I couldn't think of a way to "internally" know whether some function got instantiated. I also saw some other instantiation tests do it this way (SemaTemplate/instantiate-friend-function.cpp, SemaTemplate/inject-templated-friend.cpp). But I'm really not familiar enough with the code structure to have an opinion about this..

Also, as I wrote in the description - function explicit instantiation doesn't check constraints either but it's a different code path, so, `A<3>::f()` currently fails for the wrong reason. It will just try to instantiate the first function it finds and then fail the static assert and not the constraint.
(Or worse, fail the internal assert in `SemaTemplate.cpp:10161` if clang was built with assertions).


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