![]() This implementation matches GCC behavior in that [[ https://eel.is/c++draft/temp.func.order#6.2.1 | temp.func.order p6.2.1 ]] is not implemented [1]. I reached out to the GCC author to confirm that some changes elsewhere to overload resolution are probably needed, but no solution has been developed sufficiently [3]. Most of the wordings are implemented straightforwardly. However, for [[ https://eel.is/c++draft/temp.func.order#6.2.2 | temp.func.order p6.2.2 ]] "... or if the function parameters that positionally correspond between the two templates are not of the same type", the "same type" is not very clear ([2] is a bug related to this). Here is a quick example ``` template <C T, C U> int f(T, U); template <typename T, C U> int f(U, T); int x = f(0, 0); ``` Is the `U` and `T` from different `f`s the "same type"? The answer is NO even though both `U` and `T` are deduced to be `int` in this case. The reason is that `U` and `T` are dependent types, according to [[ https://eel.is/c++draft/temp.over.link#3 | temp.over.link p3 ]], they can not be the "same type". To check if two function parameters are the "same type": * For //function template//: compare the function parameter canonical types and return type between two function templates. * For //class template/partial specialization//: by [[ https://eel.is/c++draft/temp.spec.partial.order#1.2 | temp.spec.partial.order p1.2 ]], compare the injected template arguments between two templates using hashing(TemplateArgument::Profile) is enough. [1] https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=57b4daf8dc4ed7b669cc70638866ddb00f5b7746 [2] https://github.com/llvm/llvm-project/issues/49308 [3] https://lists.isocpp.org/core/2020/06/index.php#msg9392 Fixes https://github.com/llvm/llvm-project/issues/54039 Fixes https://github.com/llvm/llvm-project/issues/49308 (PR49964) Reviewed By: royjacobson, #clang-language-wg, mizvekov Differential Revision: https://reviews.llvm.org/D128750 |
||
---|---|---|
.. | ||
analyzer | ||
demo | ||
OpenProjects.html | ||
UniversalDriver.html | ||
builtins.py | ||
c_dr_status.html | ||
c_status.html | ||
carbon-compile.png | ||
clang_video-05-25-2007.html | ||
clang_video-07-25-2007.html | ||
compatibility.html | ||
content.css | ||
cxx_compatibility.html | ||
cxx_dr_status.html | ||
cxx_status.html | ||
diagnostics.html | ||
favicon.ico | ||
feature-compile1.png | ||
feature-compile2.png | ||
feature-memory1.png | ||
features.html | ||
get_involved.html | ||
get_started.html | ||
hacking.html | ||
index.html | ||
libstdc++4.4-clang0x.patch | ||
libstdc++4.6-clang11.patch | ||
libstdc++4.7-clang11.patch | ||
make_cxx_dr_status | ||
menu.css | ||
menu.html.incl | ||
related.html | ||
robots.txt |