Skip to content

Unexpected warning for pack indexing #112931

@breese

Description

@breese

Suppose we use the feature test macro to only use pack indexing when available

template <std::size_t N, typename... Args>
constexpr auto my_element(Args... args) {
#if __cpp_pack_indexing >=  202311L
  return args...[N];
#else
  // Do something else
#endif
}

A compiler warning is emitted when compiling for C++23 or earlier

<source>:13:16: warning: pack indexing is a C++2c extension [-Wc++26-extensions]
   13 |         return args...[N];
      |                ^
1 warning generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions