Skip to content

[temp.res.general] Unclear and incomplete requirement that packs must possibly be non-empty #878

@Halalaluyafail3

Description

@Halalaluyafail3

Full name of submitter (unless configured in github; will be published with the issue): Jay Ghiron

Reference (section label): [temp.res.general]/6

Issue description:

The program is ill-formed, no diagnostic required, if
...
every valid specialization of a variadic template requires an empty template parameter pack, or

There seem to be several issues with this text:

  1. It makes programs which do static_assert(!sizeof...(pack)) IFNDR, which seems unintended.
  2. If a template does static_assert(false), then it has no valid specializations so vacuously it is IFNDR because of this wording.
  3. It seems to make the following program IFNDR, for no apparent reason:
template<typename...T,typename...U>void foo(U...){
    int x[!sizeof...(T)!=!sizeof...(U)];//exactly one pack must be empty
}
  1. This does not apply to structured binding packs, even though existing implementations apply the same restrictions:
void foo(auto x){
    auto[...y]=x;
    union U:decltype(y)...{};//unions cannot have base classes, requires y be an empty pack
}
int main(){
    struct S{};
    foo(S{});
}
  1. It is unclear if this requirement makes zero dimensional mdspans IFNDR because of [mdspan.mdspan.members]/1:

Constraints:
...
sizeof...(OtherIndexTypes) == rank() is true

For the last point, it is unclear whether or not "every valid specialization" of a member function template in a class template refers to just the valid specializations for one member function template in a particular specialization of the class template, or instead collectively to all valid specializations of the member function templates for all specializations of the class template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions