Skip to content

Clang pretends to supports indexing a pack of template-names #135550

Open
@cor3ntin

Description

@cor3ntin
template <
    template <typename> typename... TT>
struct S {
    using First = TT...[0];
};

template <typename T>
struct U;
using A = S<U>::First;
A a;

https://compiler-explorer.com/z/b663d38hs

This code is not valid C++26 as pack indexing is only supported for types and expressions.
Clang fails to reject it, which subsequently leads to a crash at codegen.

Note that I'm writing the paper to make this well-formed, and I wonder if we shouldn't preemptively accept that as an extension or do nothing until the next WG21 meeting.

At the same time, adding a diagnostic to reject it should be easy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions