cplusplus / cplusplus/draft

[temp.arg.general] p2 template argument list of template-head seems to have a more restriction

Open
#4,845 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

The template argument list of a template-head is a template argument list in which the nth template argument has the value of the nth template parameter of the template-head. If the nth template parameter is a template parameter pack ([temp.variadic]), the nth template argument is a pack expansion whose pattern is the name of the template parameter pack.

Consider thie example

template<int I>
struct A{
    struct B;
};

template<int I>
struct A<I+0>::B{};  

The definition for class member B is rejected by most implementations. In this case, the nested-name-specifier is governed by [expr.prim.id.qual] p3

If A is the template argument list ([temp.arg]) of the corresponding template-head H ([temp.mem]), N nominates the primary template of T; H shall be equivalent to the template-head of T ([temp.over.link]).

Since I+0 can arguably be the value of the template parameter I, it should be the template argument list of the template-head. I don't know does it say has the value of the nth template parameter intends to give the possibility to the above example? However, for the parameter pack, it uses the name. From the practice, we should also use the name for the common template parameter too. It may be that

The template argument list of a template-head is a template argument list in which the nth template argument is the name(i.e. identifier) of the nth template parameter of the template-head.

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 the wording in [temp.arg.general] and compare it with [expr.prim.id.qual] p3, [temp.mem], and [temp.over.link]. Check how the A<I+0>::B example is treated by the draft and implementations. Done means the intended relationship between template parameters and template arguments is unambiguous in the standard text.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.