https://llvm.org/bugs/show_bug.cgi?id=26983
Bug ID: 26983 Summary: Overload resolution partial ordering for variadic function template with dependent type Product: clang Version: 3.8 Hardware: All OS: All Status: NEW Severity: normal Priority: P Component: C++11 Assignee: unassignedclangb...@nondot.org Reporter: bobmore...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified clang++ compiles the following code cleanly with -std=c++11: template <typename T> int add(T val) { return val; } template <typename FirstTypeT, typename... RestT> int add(FirstTypeT first_value, RestT... rest) { return first_value + add<RestT...>(rest...); } int main(void) { return add(12, 12, 12); } But the following similar code results in an ambiguous overload error: struct Foo { using SomeType = int; }; template <typename T> int add(typename T::SomeType val) { return val; } template <typename FirstT, typename... RestT> int add(typename FirstT::SomeType first_value, typename RestT::SomeType... rest) { return first_value + add<RestT...>(rest...); } int main(void) { return add<Foo, Foo, Foo>(12, 12, 12); } According to the standard, both of these should be rejected. However, it looks like clang is intended to implement the recommendation for core issue #1395 [1](for example, see https://llvm.org/bugs/show_bug.cgi?id=14372) If clang is attempting to follow the recommendation, I think it should allow both examples, and not just the first one. Credit to Columbo on stackoverflow.com for confirming that this is likely an issue. [2] [1] http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1395 [2] http://stackoverflow.com/questions/36051645/is-a-c11-variadic-function-template-overload-with-a-dependent-type-ambiguous -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs