【发布时间】:2016-05-01 21:31:05
【问题描述】:
我正在尝试编译这段 c++ 代码
template<int I> using Foo = int;
using Bar = int;
并得到这些编译器错误(使用g++ -c test.cpp)
test.cpp:1:17: error: expected unqualified-id before ‘using’
template<int I> using Foo = int;
test.cpp:2:7: error: expected nested-name-specifier before ‘Bar’
using Bar = int;
【问题讨论】:
-
这不是一个很好的自我回答问题,因为您提供的信息不足以让任何人知道答案是什么。你应该有一个minimal reproducible example 并展示它是如何编译的。
-
已编辑以提供完整、最小且可编译的示例。实际上,我认为这种特异性对于试图找出问题根源的人来说不太有用……但我想这就是规则。