C++ Logo

std-discussion

Advanced search

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

From: jim x <xmh970252187_at_[hidden]>
Date: Tue, 29 Sep 2020 10:15:53 +0800
Although `B<double>` is a template-id where `B` is a class template,
however the declaration `template <class Y> template <>
void A<Y>::B<double>::mf2() { } ` is not used to declare `B<double>`
instead it declares `mf2`. In this section [temp.expl.spec], the wording
"explicitly specialize" should mean the explicit specialization
declaration. This is the problematic place, because the entity be declared
is `mf2` which is not a *class member template*.IMHO, the actually intent
of this paragraph may be:

>In this declaration (explicit specialization declaration), each
`template-id` in nested-name-specifier that is unspecialized shall be
explicitly specialized.

I'm not 100% sure, only infer this from the result of compiling. Right?

Thiago Macieira via Std-Discussion <std-discussion_at_[hidden]>
于2020年9月28日周一 下午11:52写道:

> 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
>

Received on 2020-09-28 21:16:08