Title
Explicit instantiation of member templates
Status
nad
Section
13.9.3 [temp.explicit]
Submitter
John H. Spicer

Created on 1998-01-28.00:00:00 last changed 299 months ago

Messages

Date: 1999-04-15.00:00:00

Rationale (04/99): The Standard does not describe the meaining of multiple template keywords in this context, so the example should be considered as resulting in undefined behavior according to Clause 3 [intro.defs] “undefined behavior.”

Date: 2022-02-18.07:47:23

Is the second explicit instantiation below well-formed?

    template <class T> struct A {
        template <class T2> void f(T2){}
    };

    template void A<int>::f(char); // okay

    template template void A<int>::f(float); // ?
Since multiple "template<>" clauses are permitted in an explicit specialization, it might follow that multiple "template" keywords should also be permitted in an explicit instantiation. Are multiple "template" keywords not allowed in an explicit instantiation? The grammar permits it, but the grammar permits lots of stuff far weirder than that. My opinion is that, in the absence of explicit wording permitting that kind of usage (as is present for explicit specializations) that such usage is not permitted for explicit instantiations.

Rationale (04/99): The Standard does not describe the meaining of multiple template keywords in this context, so the example should be considered as resulting in undefined behavior according to Clause 3 [intro.defs] “undefined behavior.”

History
Date User Action Args
1999-09-14 00:00:00adminsetmessages: + msg198
1999-09-14 00:00:00adminsetstatus: drafting -> nad
1998-01-28 00:00:00admincreate