为什么clang接受代码但被vc拒绝?

clang 3.4接受以下代码;而vc NOV 2013 CTP拒绝它有一个错误
error C2668: 'AreEqual' : ambiguous call to overloaded function
template<class headT,class... tailTypes>
constexpr headT&& __GetFirst__(headT&& value,tailTypes&&...)
{
    return static_cast<headT&&>(value);
};

template<class T>
constexpr bool AreEqual(const T& a,const T& b)
{   
    return a == b;
}

template<class headT,class... tailTypes>
constexpr bool AreEqual(const headT& head_value,const tailTypes&... tail_values)
{
    return AreEqual(head_value,__GetFirst__(tail_values...))
           && AreEqual(tail_values...);
}

int main()
{
    AreEqual(1,1,2,1);  
}

哪个编译器符合C 14标准?

更新:完整的错误消息:

error C2668: 'AreEqual' : ambiguous call to overloaded function
1>          d:\projects\ktl\test\main.cpp(20): Could be 'bool AreEqual<headT,int>(const headT &,const int &)'
1>          with
1>          [
1>              headT=int
1>          ]
1>          d:\projects\ktl\test\main.cpp(8): or       'bool AreEqual<headT>(const T &,const T &)'
1>          with
1>          [
1>              headT=int
1>,T=int
1>          ]
1>          while trying to match the argument list '(const int,const int)'
1>
1>Build Failed.

解决方法

Clang(和GCC)的行为是正确的.您可以阅读标准的§14.8.2.4[temp.deduct.partial],了解如何完成功能模板的部分排序,但该子条款第8页中给出的示例直接涵盖了这种情况:
template<class... Args> void f(Args... args); // #1
template<class T1,class... Args> void f(T1 a1,Args... args); // #2
template<class T1,class T2> void f(T1 a1,T2 a2); // #3
f(); // calls #1
f(1,3); // calls #2
f(1,2); // calls #3; non-variadic template #3 is more
         // specialized than the variadic templates #1 and #2

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...