在明确的专业化中不允许存储类
A storage class is not allowed in an explicit specialization
我在不属于类的标题文件中具有以下代码:
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();
}
该代码可以使用较旧的GCC版本进行编译,但是在较新的版本中,我会收到此错误消息:
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) {
^
是否知道为什么它可以与较旧版本的GCC一起使用,而不是与新版本一起使用?另外,我该如何使用GCC 5?
原因在以下报价中,现在在C 标准中:[dcl.stc]/p1
不得在明确的专业化中指定thread_local以外的存储类别
相关文章:
- 为什么 Clang 不允许"and"作为函数名称?
- 不允许在向量中添加更多元素
- std::带有自定义缓冲区的 iostream 不允许我写入
- Visual Studio 2017 不允许我创建 C++ 专用模板
- 返回时不允许隐式转换
- 为什么 c++(g++) 不允许模板返回类型和函数名称之间有空格?
- 为什么 c++ 不允许(自动)强制转换?
- 为什么 c++11 不允许使用自动
- 为什么不允许成员函数和非成员函数之间的函数重载?
- 为什么不允许使用可变长度数组作为向量元素?
- 余数除法和不允许除以零 (c++) 时遇到问题
- C++从外部类继承的嵌套类;不允许使用不完整的类型
- 在 c++ 中三元运算符中不允许继续(关键字)吗?
- 为什么在指向对象的迭代器上调用函数不允许我更改对象本身?
- 错误:在第 6 行'{'标记之前,此处不允许使用函数定义
- 不允许在类定义之外重写
- 不允许运算符 const 参数调用 const 成员函数
- 为什么 std::d eque 不允许指定存储桶大小?
- 在明确的专业化中不允许存储类
- PostgreSQL C API (libpq)允许你使用结果而不是存储它吗?