Skip to content

[Clang] Error on pack indexing in return type #105900

@Sirraide

Description

@Sirraide

Consider (https://godbolt.org/z/3ThcG9r9d):

template <typename... opts>
struct temp  {
    template <unsigned idx>
    static constexpr __SIZE_TYPE__ get_index() { return idx; }

    template <unsigned s>
    static auto x() -> opts...[get_index<s>()] {}
};

Attempting to call x like this

temp<void>::x<0>();

fails with the following (rather weird) error:

<source>:11:5: error: no matching function for call to 'x'
   11 |     temp<void>::x<0>(); // Error
      |     ^~~~~~~~~~~~~~~~
<source>:7:17: note: candidate template ignored: substitution failure [with s = 0]: array size is not a constant expression
    7 |     static auto x() -> opts...[get_index<s>()] {}
      |                 ^              ~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions