I have the following code in a header file that does not belong to a class:
template<typename Foo> static const Compl<Foo,bar> *foobar (const FBTYPE &x);
template<> static const Compl<typea,bar> *foobar<typea>(const FBTYPE &x) {
return x.funcA();
}
template<> static const Compl<typeb,bar> *foobar<typeb>(const FBTYPE &x) {
return x.funcB();
}
The code compiles just fine with older GCC versions but in newer ones I get this error message:
rsvt.h(672): error #3503: a storage class is not allowed in an explicit specialization
template<> static const Compl<typea,bar> *foobar<typea>(const FBTYPE &x) {
^
Any idea why it works with older versions of GCC but not with newer ones? Also, how can I get it to work with GCC 5?
The reason is in the following quote which is now in the C++ standard: [dcl.stc]/p1
A storage-class-specifier other than thread_local shall not be specified in an explicit specialization
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With