namespace X
{
struct type {};
}
namespace Y
{
using type = int;
}
using X::type;
using Y::type;
int main()
{
auto i = sizeof(type); // GCC和MSVC接受,但Clang拒绝
}
Clang的报错信息:
:13:21: error: reference to 'type' is ambiguous
auto i = sizeof(type);
^
:10:10: note: candidate found by name lookup is 'type'
using Y::type;
^
:9:10: note: candidate found by name lookup is 'type'
using X::type;
^
:13:21: error: reference to 'type' is ambiguous
auto i = sizeof(type);
^
:10:10: note: candidate found by name lookup is 'type'
using Y::type;
^
:9:10: note: candidate found by name lookup is 'type'
using X::type;
^