Skip to content

[clang] Clang trunk regression breaks SFINAE with zero-sized array template parameter #170040

@forworldm

Description

@forworldm
#include <cstdint>
#include <cstddef>

template<int N> struct Foo {
    operator uint16_t() const noexcept requires(N == 2) {
        return 0;
    }

    template<int I = 0, char (*)[(N == 8) || (I & 0)] = nullptr>
    operator uint64_t() const noexcept {
        return 0;
    }
};

int main() {
    Foo<2> foo;
    std::size_t bar = foo;
    return bar;
}

clang emits: error: zero-length arrays are not permitted in C++.
Earlier versions of Clang (up to 21) compiled the same code without issues.
see godbolt

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"regression

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions