C++ Logo

std-discussion

Advanced search

nodeclspec-function-declaration

From: Russell Shaw <rjshaw_at_[hidden]>
Date: Thu, 25 Apr 2024 23:33:05 +1000
Hi,

In 9.12 p164 General [dcl.dcl] 14882:2020(E) :

------------------
12
A nodeclspec-function-declaration shall declare a constructor, destructor, or
conversion function.

[Note 3 : A nodeclspec-function-declaration can only be used in a
template-declaration (13.1), explicit-instantiation (13.9.3),
or explicit-specialization (13.9.4). — end note]

------------------

I can get the 'explicit-instantiation' and 'explicit-specialization' to work,
but how do i get the 'template-declaration' to work ?

++++++++++++++++++

template<typename T> struct S {
     S();
};

template<> S<int>::S();

template S<int>::S();

template<typename T> S<T>::S(); <-- error: declaration of ‘S<T>::S()’
   outside of class is not definition [-fpermissive]

++++++++++++++++++

Received on 2024-04-25 13:33:10