C++ Logo

std-discussion

Advanced search

Re: Ambiguity in the definitions of the explicit instantiation declaration and the explicit instantiation definition

From: Brian Bi <bbi5291_at_[hidden]>
Date: Fri, 2 Aug 2019 12:45:19 -0500
On Fri, Aug 2, 2019 at 10:31 AM Vladimir Grigoriev via Std-Discussion <
std-discussion_at_[hidden]> wrote:

> In the p.#2 of the section 13.8.2 Explicit instantiation (C++20) there is
> written
>
> There are two forms of explicit instantiation: an explicit instantiation
> definition and an explicit instantiation declaration. An explicit
> instantiation declaration begins with the extern keyword.
>
> However then in the p.#6 there is written
>
> Despite its syntactic form, the declaration in an explicit-instantiation
> for a variable is not itself a definition and does not conflict with the
> definition instantiated by an explicit instantiation definition for that
> variable.
>
> So it seems these two quotes confuse readers of the Standard.
>

I think what's really confusing here is the method of description here,
where (according to p6) the translation of an explicit instantiation
notionally generates two declarations. I'm not sure why it's like this (it
seems to be new in C++20) but I imagine the committee has a good
reason. Once you accept this, I don't think the sentence at the end of p6
is that confusing. However I do think [basic.def]/2 should be amended to
contain the additional exception (i.e., "... --- it is an explicit
instantiation definition of a variable template"). Otherwise there is a
contradiction between [basic.def] and [temp.explicit].


>
> With best regards,
> Vlad from Moscow
>
> You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or
> http://ru.stackoverflow.com
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-discussion
>


-- 
*Brian Bi*

Received on 2019-08-02 12:47:31