Skip to content

Clang crashes in clang::Sema::BuildExpressionFromIntegralTemplateArgument with c++2b #55509

@schaumb

Description

@schaumb

The following code makes clang to crash. See at godbolt.

template<int N>
struct A {
    template<class C>
    friend auto cica(const A<N-1>&, C) {
        return N-1;
    }
};

template<>
struct A<0> {
    template<class C>
    friend auto cica(const A<0>&, C);
};

template <int N, class AT, class = decltype(cica(AT{}, nullptr))>
static constexpr bool MakeCica(int);

template <int N, class AT>
static constexpr bool MakeCica(short, A<N+1> = {});

template <int N, class AT = A<N>, class Val = decltype(MakeCica<N, AT>(0))>
static constexpr bool has_cica = Val{};

constexpr bool cica2 = has_cica<0> || has_cica<0>;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions