<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/68543>68543</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Assertion faulure in `TreeTransform<Derived>::TransformExceptionSpec` in C++17 compilation
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wjristow
      </td>
    </tr>
</table>

<pre>
    We have run into an assertion-failure compiling in C++17 mode.  Here is a reduced test-case:

    namespace a {
 inline namespace c {
    template <class e> constexpr bool f = __is_member_object_pointer(e);
    struct g {
      template <class h, class... i>
      static auto ae(h p1, i... j) -> decltype(p1(j...));
 };
    template <class h, class k = h, bool = f<k>> struct l;
 template <class h, class k> struct l<h, k, false> : g {};
    template <class h, class m, class... r>
    auto ag(h p1, m j, r... o) -> decltype(l<h>::ae(p1, j, o...));
    struct ai {
      template <class m, class n> auto operator()(m p1, n j) -> decltype(p1 > j);
    };
 template <class e, e...> struct q {};
    template <class e, e as> using at = __make_integer_seq<q, e, as>;
    template <long... au> using av = q<unsigned long, au...>;
    template <long as> using aw = at<unsigned long, as>;
    template <class... i> using ax = aw<sizeof...(i)>;
 int bg;
    struct t {
      template <class bo, class... p>
 static auto ae(bo p1, p... j) -> decltype(ag(p1, j...));
    };
 template <class bq, unsigned long... br, class bs, class bt, class bl>
 auto bu(bq, av<br...>, bs o, bt, bl) -> decltype(bq ::ae(o, br...));
 template <class, class, class... i> class bw {
      using bx = ax<i...>;
      int ca;

    public:
      template <class...> auto operator()() noexcept(noexcept(ca)) {
        ai s;
        return bu(t{}, bx{}, s, ca, bg);
      }
    };
    template <class bo, class... i> bw<int, bo, i...> bind(bo, i...);
    } // namespace c
 } // namespace a
    struct F {
      template <typename b,
 typename = decltype(static_cast<bool (b::*)()>(&b::operator()))>
 F(b *);
    };
    int cb;
    a::bw cc = bind(a::ai(), 0, cb);
    F d() { return &cc; }

The assertion is:

 /root/llvm-project/clang/lib/Sema/TreeTransform.h:6197:
      bool clang::TreeTransform<Derived>::TransformExceptionSpec(clang::SourceLocation, clang::FunctionProtoType::ExceptionSpecInfo&, llvm::SmallVectorImpl<clang::QualType>&, bool&) [with Derived = {anonymous}::SubstituteDeducedTypeTransform]:
      Assertion `ESI.Type != EST_Uninstantiated && ESI.Type != EST_Unevaluated' failed.

godbolt link: https://godbolt.org/z/9vdsPo9hG

FTR, it isn't a recent regression.  I tried it with llvm16 and llvm15, and they both hit the equivalent assertion failure.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycV01z6joS_TVi0xUXyHwuWAAJM6maxZ1J5r0lJdkNKJElR5Ihub_-VcsGG0Jy73sbSqjVR92nT0uW8F7tDOKcjZZsdN8TVdhbNz--OOWDPfakzT_mfyLsxQHBVQaUCRaEAeE9uqCsudsKpSuHkNmiVFqZHSgDK8aXjC8HEyhsjgnAv9EhKA8CHOZVhjkE9OEuEx5ZumD9e9ZvfgEAjCjQlyJDEMAmy8agjFYGO8asYwSAgEWpRUBg6SrTwntAlj5AZo0P-F46kNZq2AJL72GzUX5TYCHRbax8wSxsSqtMQMf4FBmfsbSD7IOrsgC7y_1u7bhnfAVxmCQJKJY-dNf7IILKQFREIjI-3UM5IA9Fq18Yn8EdhZxjpsNHSSvIPn1JkoRi6obFJvcXMX4XC7zGpONEJIH-bVm6eqUA04dTgrpF_B7u0mcVTa_0sxXaR9ZZumj4-jtxFhf0uQv6atZ2HdYKomwFjtbaW-TVsVGKC5YuxInPVe1nb7DaFluoX1e7DRcMbR1DtCU6ESwJKaJPiyZc81WFgWZeruO4IO6WtvkKkFJoa_H2e4TXriA8uVaeelaEpi0K8YobaoQduo3HN5au3uJy-okeX4Jra3ZUClF1cA8Rl2AqE8-aHGhdRKvq6L8FvIzyGNFEuAn3bXAXPXmCe6_hjixdefUT7TYqYqpiKTpYygSQu1sqCb8WibQ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