C++ Logo

std-discussion

Advanced search

Re: An confusion about the paragraph [temp.expl.spec#18]

From: jim x <xmh970252187_at_[hidden]>
Date: Fri, 9 Oct 2020 09:55:12 +0800
I think this paragraph [temp.spec#general-3.sentence-3]
<http://eel.is/c++draft/temp.spec#general-3.sentence-3> does not say that
the specialization is implicitly instantiated, it just says that the
declaration shall be a template-id if the entity is variable or class. In
other words, such as a `template-name<T>` is still a template-id. If it
says that the declaration for these entities shall be a template-id which
would cause *implicit instantiation*, in this way, this will mean that the
template-argument-list shall not contain any template-parameter. In
addition, this paragraph [temp.expl.spec#6]
<http://eel.is/c++draft/temp.expl.spec#6>, the phrase "explicitly
specialized " sounds like there is an explicit specialization declaration
for the entity. So, use this phrase in the paragraph [temp.expl.spec#18]
<http://eel.is/c++draft/temp.expl.spec#18> indeed make the meaning mixed.

Johannes Schaub via Std-Discussion <std-discussion_at_[hidden]>
于2020年9月30日周三 上午4:39写道:

> The introduction of "templated entity" helped, but there seems to be
> something to clarify or fixed about the notion of "explicit specialization"
> (?). http://eel.is/c++draft/temp.spec#general-3.sentence-3 and the
> follow-up example for the static data member (though non-normative, but
> helps to identify the intent) indicates that in a specialization of a
> member definition for an implicit instantiation of its enclosing template,
> the set of entities that are considered to be explicitly specialized (at
> least in the context of this declaration) include the surrounding class,
> but whose specialization is _implicitly_ instantiated!
>
> Am Di., 29. Sept. 2020 um 21:45 Uhr schrieb Johannes Schaub <
> schaub.johannes_at_[hidden]>:
>
>> I disagree. What happens is that B<double> names "a given implicit
>> instantiation" of B, and what is being explicitly specialized is a member
>> of that implicit instantiation. This is the case at
>> http://eel.is/c++draft/temp#expl.spec-16 .
>>
>> Am Mo., 28. Sept. 2020 um 17:52 Uhr schrieb Thiago Macieira via
>> Std-Discussion <std-discussion_at_[hidden]>:
>>
>>> On Monday, 28 September 2020 01:51:24 PDT jim x via Std-Discussion wrote:
>>> > Consider the above example, The comment says that the code is
>>> ill-formed.
>>> > However, I have to say, such a case is not covered by this rule. My
>>> reason
>>> > is that, please note the bolded wording, that is "class member
>>> template",
>>> > in this explicit specialization, `mf2` is not a class member
>>> *template, *it
>>> > just a member of a class template
>>>
>>> B<double> is being specialised and that is a template.
>>>
>>> --
>>> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
>>> Software Architect - Intel DPG Cloud Engineering
>>>
>>>
>>>
>>> --
>>> Std-Discussion mailing list
>>> Std-Discussion_at_[hidden]
>>> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>>>
>> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>

Received on 2020-10-08 20:55:28