- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面的代码在Visual Studio 2013,gcc 4.8,clang 3.4和clang 3.5(Apple LLVM 6.0)中编译,但不在clang 3.6中(通过Apple LLVM 6.1)编译
该代码是我们代码库中复杂类的简化版本,这是显示问题的最低要求。
问题的症结在于,由于存在接受TYPED_VALUE
的构造函数,因此在3.6中,STRING
的副本构造将评估STRING
类型的模板化转换运算符;这将导致对std::is_constructible
进行求值,从而导致它需要STRING
的定义(我们在此无法提供-会导致完整代码中的循环依赖)。
class STRING;
class TYPED_VALUE
{
public:
TYPED_VALUE( const TYPED_VALUE& ) = default; // explicit or implicit doesn't make a difference
TYPED_VALUE( const STRING & ) {}
template< typename TYPE, typename std::enable_if<!std::is_pointer< TYPE >::value && !std::is_constructible< TYPE, const STRING& >::value && !std::is_constructible< TYPE, bool >::value, int >::type = 0 >
operator TYPE( void ) const = delete;
};
class TYPED_STORAGE
{
public:
TYPED_STORAGE( const TYPED_VALUE &v ) : value( v ) {}
TYPED_VALUE value;
};
/type_traits:2329:38: error: incomplete type 'SICORE::STRING' used in type trait expression
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
^
/main.cpp:348:99: note: in instantiation of template class 'std::__1::is_constructible<SICORE::STRING, const SICORE::STRING &>' requested here
template< typename TYPE, typename std::enable_if<!std::is_pointer< TYPE >::value && !std::is_constructible< TYPE, const STRING& >::value && !std::is_constructible< TYPE, bool >::value, int >::type = 0 >
^
/main.cpp:349:9: note: while substituting prior template arguments into non-type template parameter [with TYPE = SICORE::STRING]
operator TYPE( void ) const = delete;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/main.cpp:355:56: note: while substituting deduced template arguments into function template 'operator type-parameter-0-0' [with TYPE = SICORE::STRING, $1 = (no value)]
TYPED_STORAGE( const TYPED_VALUE &v ) : value( v ) {}
^
/main.cpp:340:11: note: forward declaration of 'SICORE::STRING'
class STRING;
^
最佳答案
我相信Clang会产生此错误是正确的:
第10段中C++标准的[temp.inst]部分说:
If a function template or a member function template specialization is used in a way that involves overload resolution, a declaration of the specialization is implicitly instantiated (14.8.3).
关于c++11 - Clang 3.5和3.6之间的过载分辨率更改是否正确还是错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29616985/
在我看来,CakePHP 中的对象过载过多。我在我的布局中输出调试:debug($this); 并且我发现了 6 个 HTML 帮助对象实例: [Html] => HtmlHelper Object
Product **products; int numProducts = 0; void setup() { ifstream finput("products.txt"); //g
为什么返回 5,我很好奇这个普通函数比默认参数 one 有更高的优先级。有人可以向我解释一下吗?提前致谢 static void Main(string[] args) { Conso
我现在遇到 mysql 过载的问题,然后当它非常繁忙时,服务器将完全停止响应。我知道我的一个数据库有大量流量,但我该如何处理这个问题。我是否需要一台更好的服务器,或者我是否需要一个不同的数据库引擎。目
由于插入查询的过载,我最近开始遇到一些严重的服务器问题。我们服务器上的所有查询一直以来都得到了优化,但是由于大量的 INSERT 查询,流量再次回升并且 CPU 已达到极限。 我们为访问我们网站的每位
我收到这些错误: circleType.cpp||In function 'std::ostream& operator<<(std::ostream&, circleType&)':| circle
好的,我一直是 inspired to do some head punching .似乎重载 operator& 会导致不小的痛苦。 存在哪些合理的重载情况? (不能说我曾经这样做过......)
RabbitMQ 集群不接受新连接! 连接的套接字数量很少,Rabbitmq 日志中的唯一消息是: ** WARNING ** Mnesia is overloaded 这意味着什么?我该如何解决?
我们可以使用 lombok 来生成 setter,如下所示: @Data //or @Setter public class Test { int a;
我正在尝试将大约 1 GB 大小的文件下载到具有 1 GB RAM 内存的服务器,因此如果我尝试将其下载到变量中(下面的代码),操作系统会因 RAM 过载而终止进程. require LWP::Use
这个简单的程序无法编译。 [使用 XE5 和 D10 进行测试。] program Project10; {$APPTYPE CONSOLE} {$R *.res} uses System.Cla
我得到了这台服务器带有 8GB DDR3 RAM 的 Intel Xeon 四核 E3-1230v2 我发现这台服务器的 CPU 正在耗尽。看起来严重重载。观察“每日进程日志”后,我意识到下面的进程占
问题: 我遇到的问题是我的应用程序运行缓慢,因为我在一个文件 (index.html) 中运行了太多页面(page1.html、page2.html 和 page3.html),重点是让用户决定他/她
我试图以这种方式重载 std::find 函数: include include include "Marker.h" namespace Test { class MarkerConta
我有一个动画和 JS,用于交替 2 个 div 并更改它们的背景图像(来自几十个图像的数组),有点可互换的 div。一切正常,但是当动画运行时我可以看到我的 CPU 处于 100%。起初我认为这可能是
我刚刚重新安装了 Vim,这次我在我的 VIM 配置中添加了一些新插件。问题是,现在,当我对文件进行第一次更改时,VIM 会阻塞并且我的一个 CPU 达到 100% 负载。当我编辑文件时,这种情况也会
我是一名新编码员,正在学习 Marionette 来制作 session 预订应用程序。我已经打听了好几个小时,并且已经敲了我的头好几个小时了。 基本上,问题是这样的,当我添加 session 时,会
我正在尝试在 CloudSim Plus 模拟器中进行水平自动缩放。我需要通过多个虚拟机来扩展应用程序。我正在尝试修改示例 LoadBalancerByHorizontalVmScalingExamp
有没有一种方法可以强制 C# 编译器忽略缺少的对象运算符重载,而是在运行时处理该检查?我问是因为我有一个包含多个对象的容器,这些对象具有类型为 int、string、ushort 等的各种属性。我正在
好的,我有这个查询,它为我提供了 DISTINCT product_series,以及表中的所有其他字段: SELECT pi.* FROM ( SELECT DISTINC
我是一名优秀的程序员,十分优秀!