Clang frontend C++ crash on invalid code when using some built-in type traits (original) (raw)

To quickly reproduce: https://gcc.godbolt.org/z/K1sTM53s7

#include #include

enum Day { sunday, monday, tuesday, wednesday, thursday, friday, saturday };

class A {};

int main() { std::__add_rvalue_reference::type ptr; // swap __add_rvalue_reference for (__add_pointer or __add_rvalue_reference) also leads to same crash }

Compiling the above invalid code crashes clang clang++ -x c++ -std=c++23, crashes locally using clang-17.0 (a10019a), also on trunk (see godbolt link)

Note: Also tested with other built-in type traits like __add_pointer and __add_rvalue_reference and also leads to the same crash. Not sure if there could be more.