cplusplus / cplusplus/draft

[temp.variadic] p6 Rearrange the rule and make the meaning clearer

Open
#5,553 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[temp.variadic] p6 says

For the purpose of determining whether a pack satisfies a rule regarding entities other than packs, the pack is considered to be the entity that would result from an instantiation of the pattern in which it appears.

Actually, we also want to check the requirement for syntax where the pack appears but not just the rules for entities. For example:

template<class...T>
struct S{
   std::tuple<unsigned T...> tp;  // #1
};

At #1, we want to consider the pack T as a typedef-name, and unsigned typedef-name is not a valid combination of simple-type-specifiers summarized in [dcl.type.simple] p3, hence the combination is invalid.

Rearrange [temp.variadic] p6 to the place after [temp.variadic] p8, and change it to

For the purpose of determining whether a pack satisfies the requirements defined in this document, the pack is considered to be the element that would be used for replacing in the context of the instantiation.

template<class ...T>
struct A:T...{  //#1 ok
   std::tuple<typename T::type....> tp;  // #2  ok 
};

template<class ...U>
struct B{
   std::tuple<U&...> tp; // #3 ok 
};
B<void> b; // error

The pack T interpreted as a typedef-name can form a base-specifier at #1 and a nested-name-specifier at #2. The pack U interpreted as a typedef-name can form a type-id at #3 however the typedef-name that designates the entity void in the instantiation context forms a reference to void, which is ill-formed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [temp.variadic] paragraphs 6 and 8 and compare the surrounding wording with the examples in the issue. Move paragraph 6 after paragraph 8 and replace it with the proposed rule about requirements and replacement context. Check that the resulting text covers both syntactic requirements and entity requirements illustrated by the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
tex
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.