[PATCH] D133262: [clang] Fixes how we represent / emulate builtin templates

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 8 15:00:50 PDT 2022


royjacobson added a comment.

In D133262#3778555 <https://reviews.llvm.org/D133262#3778555>, @mizvekov wrote:

> The snippets from the bug reports are using libc++ and std::make_integer_sequence directly, which we avoid in these kinds of regression tests, we tend to make very reduced test cases that compile standalone.
>
> But I believe I included reductions that should show we fixed the same problem, unless I missed some specific case.

I haven't seen something similar enough to the default template argument case from 42102, so it would be nice to add that one. `std::make_integer_sequence` is just a type alias template to the builtin, so you can do

  template <class A1, A1... A2> struct A {};
  
  // GH42102
  
  template<int S>
  using make_index_sequence = __make_integer_seq<A, int, S>;
  
  template <int S, class=make_index_sequence<S>>
  struct FooList;
  template <int S, int... Idxs>
  struct FooList<S, A<int, Idxs...>> { };
  
  template <int S>
  void foobar(FooList<S>) { }
  
  void test() { 
    foobar(FooList<5>{});
  }
  
  // GH51928
  
  template <typename T, typename Seq>
  struct X;
  
  template <typename T>
  struct X<T, make_index_sequence<sizeof(T)>> {
  };
  
  X<char, make_index_sequence<1>> x;

to get unittests without libc++.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133262



More information about the cfe-commits mailing list