[PATCH] D110727: [clang] don't instantiate templates with injected arguments

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 29 12:59:15 PDT 2021


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

I think it's almost always true that we don't substitute into a template unless we've already substituted into all enclosing templates. The only exception I can think of is alias templates, which are substituted early, even in dependent contexts. So a case like:

  template<typename T> struct A {
    template<typename U> using B = decltype([](auto){}(U()));
    void f(B<int>);
  };
  A<int> ai;

... might run into some problems here. But I would note we //already// crash on that testcase (and GCC miscompiles it, treating `B<int>` as `int` rather than `void`). So I suspect that's another whole can of worms.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110727



More information about the cfe-commits mailing list