Skip to content

[Clang 18->19 regression] __is_trivially_equality_comparable requires more completeness than it used to #35

@Quuxplusone

Description

@Quuxplusone

https://godbolt.org/z/bq3cj6Yxd

template<class T> struct Holder { T t; };
struct Incomplete;
static_assert(!__is_trivially_equality_comparable(Holder<Holder<Incomplete>*>));

Clang 17 and 18 accept this snippet. Clang trunk (the rising Clang 19) does not accept it:

<source>:1:37: error: field has incomplete type 'Incomplete'
    1 | template<class T> struct Holder { T t; };
      |                                     ^
<source>:3:16: note: in instantiation of template class 'Holder<Incomplete>' requested here
    3 | static_assert(!__is_trivially_equality_comparable(Holder<Holder<Incomplete>*>));
      |                ^
<source>:2:8: note: forward declaration of 'Incomplete'
    2 | struct Incomplete;
      |        ^

This is caused by c6e996a (llvm#93113, llvm#97894). Maybe it's an unavoidable side effect of the new approach; but it's kind of inconvenient because it means __is_trivially_equality_comparable can't be used as a generic building block in many situations (because it can trigger a hard error instead of just returning false). It would certainly be nice if Clang 19 would behave the same way as Clang 18 for this three-line snippet. (attn @philnik777)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions