Skip to content

Clang frontend C++ crash on invalid code when using some built-in type traits #63243

Closed
@brutalsavage

Description

@brutalsavage

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

#include <type_traits>
#include <cstddef>

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

class A {};

int main() {
   std::__add_rvalue_reference<A>::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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrash-on-invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions