cplusplus / cplusplus/draft

[temp.deduct.type] p4 Template parameter pack is only used in non-deduced context

Open
#5,343 0 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.deduct.type] p4 states that:

If a template parameter is used only in non-deduced contexts and is not explicitly specified, template argument deduction fails.

Consider this example:

template<class...T, class U>
void fun(T...,U){
}
fun(0); // all major implementations accept it.

[temp.deduct.type] p5 states that the template parameter pack T is used in a non-deduced context:

The non-deduced contexts are:

  • [...]
  • A function parameter pack that does not occur at the end of the parameter-declaration-list.

The parameter is only used in a non-deduced context. [temp.arg.explicit.note]/1 also implies the example is ok. The following change may be an improvement:

If a template parameter that is not a template parameter pack is used only in non-deduced contexts and is not explicitly specified, template argument deduction fails.

Relevant issue: https://github.com/cplusplus/draft/issues/4555

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 by reading [temp.deduct.type] paragraphs 4–5 and [temp.arg.explicit.note]/1, then compare their wording with the provided template example. Review whether the proposed exception for template parameter packs resolves the stated deduction behavior; done means the draft wording clearly reflects the intended rule.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.