我刚刚注意到在安装OS X 10.9之后,g ++编译器链接到clang编译器.无论如何还有恢复到gcc/g ++?
以下代码编译良好g++ (GCC) 4.7.1 20120721,但最近构建失败clang version 3.2 (trunk).
struct Y {};
struct X {
operator const Y() const { return Y(); }
};
void f(Y&& y) {}
int main()
{
f(X());
return 0;
}
Run Code Online (Sandbox Code Playgroud)
将转换运算符更改operator Y() const为足以使代码在两个编译器上进行编译.
在这种情况下,哪个编译器实际上符合标准?标准实际上对此有何看法?
请求的逐字错误:
bla.cpp:14:5: error: no viable conversion from 'X' to 'Y'
f(X());
^~~
bla.cpp:1:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'X' to
'const Y &' for 1st argument
struct Y { …Run Code Online (Sandbox Code Playgroud) 似乎C++标准库中只有双重链表(但没有单链表),对吧?有没有广泛使用的带有单链表的C++库?