-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Closed
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
See https://godbolt.org/z/19EKoc86z or pack_indexing.zip.
The code contains this definition of __m_at_c:
#ifdef LAUNDER
template <unsigned long _Idx, unsigned long _Cnt>
struct ___m_at {
static_assert(_Idx < _Cnt);
static constexpr unsigned long value = _Idx + _Cnt * 0;
};
template <unsigned long _Np, class... _Ts>
using __m_at_c = _Ts...[___m_at<_Np, sizeof...(_Ts)>::value];
#else
template <unsigned long _Np, class... _Ts>
using __m_at_c = _Ts...[_Np];
#endifWhen LAUNDER is defined, the pack indexing subscript is laundered through the class template ___m_at and compilation succeeds. When it is not defined, the subscript is used directly, and Clang produces the following diagnostic:
pack_indexing3.cpp:12:25: error: invalid index 1 for pack '_Ts' of size 1
12 | using __m_at_c = _Ts...[_Np];
| ^
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"