llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

The intersection of a concept which isn't satisfied and deducing this crashes clang 19

Open ojrosten opened this issue 1 year ago • 2 comments

The following code crashes the compiler:

template<class T>
concept check_for = requires(T t) { check(t); };

struct foo{
    template<class Self>
    void check(this Self& self, int);

    static_assert(check_for<int>);
};

https://godbolt.org/z/cTd3bna8G

It looks like this is fixed on trunk. However, I haven't been able to track down what fixed it so thought this bug report may be useful.

ojrosten avatar Jan 04 '25 15:01 ojrosten

@llvm/issue-subscribers-clang-frontend

Author: Oliver Rosten (ojrosten)

The following code crashes the compiler:
template&lt;class T&gt;
concept check_for = requires(T t) { check(t); };

struct foo{
    template&lt;class Self&gt;
    void check(this Self&amp; self, int);

    static_assert(check_for&lt;int&gt;);
};

https://godbolt.org/z/cTd3bna8G

It looks like this is fixed on trunk. However, I haven't been able to track down what fixed it so thought this bug report may be useful.

llvmbot avatar Jan 04 '25 15:01 llvmbot

This was fixed for #102025, with llvmorg-20-init-02565-g7332713b8ee ("[Clang] prevent null explicit object argument from being deduced (#104328)") by @a-tarasyuk CC @cor3ntin @mizvekov.

DimitryAndric avatar Jan 04 '25 17:01 DimitryAndric