cplusplus / cplusplus/draft

[temp.expl.spec] p6 not only applies to definitions

Open
#4,815 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.expl.spec] p6

Members of an explicitly specialized class template are defined in the same manner as members of normal classes, and not using the template<> syntax. The same is true when defining a member of an explicitly specialized member class. However, template<> is used in defining a member of an explicitly specialized member class template that is specialized as a class template.

The rule seems not only applied to define that member but also includes explicit-specialization.

template<class T>
struct A{
    template<class Y>
    struct B{};
};

template<>
struct A<int>{
    template<class Y>
    struct B;
};

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

[class.mem.general] p6

A redeclaration of a class member outside its class definition shall be a definition, an explicit specialization, or an explicit instantiation ([temp.expl.spec], [temp.explicit]). The member shall not be a non-static data member.

Could we change the wording "define" to "redeclare" to include these cases?

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.expl.spec] p6 and [class.mem.general] p6, then compare their use of “defining” with the explicit-specialization examples in the issue. Update the draft wording only if the rule should cover explicit specializations as proposed, and verify that the example declarations are described consistently.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.