cplusplus / cplusplus/draft

The wordings of the paragraph [temp.dep.type#1] miss some examples

Open
#4,199 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

template<class T> struct A {
  typedef int M;
  struct B {
    typedef void M;
    struct C;
  };
};

template<class T> struct A<T>::B::C : A<T> {
  M m;                          // OK, A<T>​::​M
};

For this example, the base class A<T> refers to a current instantiation name, hence it's not a dependent base class, hence name lookup will find name M in A<T>. However, the rule defines what is a current instantiation name are as the following:

A name refers to the current instantiation if it is

in the definition of a primary class template or a member of a primary class template, the name of the class template followed by the template argument list of the primary template (as described below) enclosed in <> (or an equivalent template alias specialization),

However, in the above example, we define the class C which is not the member of class template A. Firstly, these's no any rule in the standard describes such a member of a nested class is also considered as a member of a class of which the nested class is a member. Secondly, If we consider such a member (class C) is a member of the outmost enclosing class, then it would change the meaning of far too many other rules about members(discussed in this topic of std-discussion ). IIUC, the intent of [temp.dep.type#1] want to cover that any name of these enclosing classes(enclosing class templates) is the current instantiation name(include the template-id whose template-name is the name of these enclosing classes).

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 paragraph [temp.dep.type#1] and the nested-class C++ example in the issue. Read the linked std-discussion topic to understand the concern about members of enclosing class templates and current instantiation names. Done means the standard wording and examples clearly resolve whether this case is covered.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.