Skip to content

Clang frontend C++ crash on referencing undeclared member during class initialization  #63496

@brutalsavage

Description

@brutalsavage

To quickly reproduce: https://gcc.godbolt.org/z/Mxbvv6Y1s (assertion-trunk)

#include <tuple>
#include <type_traits>

template < typename... T >
using variant_impl = std::tuple<int, int>;

template < typename... T >
struct variant : 
public std::conditional_t<
        false,
        int,
        variant_impl<T...>
> {
        // int value; // note if uncomment this line, code compiles correctly
        template < typename... T_ >
        constexpr variant(T_ &&... ts) : value(){};
};


int main() {
    variant<int> v{42};
    return 0;
}

Compiling the above code crashes clang clang++ -x c++ , crashes locally using clang-17.0 (a10019a), also on trunk with assertion (see godbolt link)

Note that adding back the int value; leads to successful compilation

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions