https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96445
Bug ID: 96445
Summary: extern template results in missing constructor symbol
Product: gcc
Version: 10.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tyu at eridex dot org
Target Milestone: ---
Created attachment 48989
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48989&action=edit
g++ -v output
The following results in: undefined reference to `C<int>::C(int)'
template <typename T>
class C {
private:
constexpr C(T){};
public:
constexpr static C<T> make(T t) { return C<T>(t); }
};
extern template class C<int>;
inline constexpr C<int> constant = C<int>::make(0);
template class C<int>;
int main() { return 0; }
Compiled with:
$ g++ -v -save-temps -std=c++2a -Wall -Wextra issue.cpp > output.txt 2>&1
output.txt is attached.