Xcode 16's clang : failure to recognise function type for static member function template in class template

Hello,

It appears that clang version provided by Xcode 16 brings this compilation error seen in previous LLVM version : https://github.com/llvm/llvm-project/issues/91362

Fixed in : https://github.com/llvm/llvm-project/pull/90760

#include <type_traits>

template <typename T>
struct class_tmpl {
    template <bool B> static int call_e() { return 0; }
    template <bool B> static int call_ne() noexcept { return 0; }
    template <bool B> static int call() noexcept(std::is_nothrow_copy_assignable<T>::value) { return 0; }
};

int main(int argc, char *argv[])
{
    using function_ptr = int (*)();
    function_ptr f1 = &class_tmpl<int>::call_e<false>;
    function_ptr f2 = &class_tmpl<int>::call_ne<false>;
    function_ptr f3 = &class_tmpl<int>::call<false>;
    return 0;
}

$ clang -std=c++17 main.cpp

main.cpp:15:24: error: address of overloaded function 'call' does not match required type 'int ()'
   15 |     function_ptr f3 = &class_tmpl<int>::call<false>;
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:7:34: note: candidate template ignored: substitution failure [with B = false]
    7 |     template <bool B> static int call() noexcept(std::is_nothrow_copy_assignable<T>::value) { return 0; }
      |                                  ^
1 error generated.

Compiler informations :

clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Answered by DTS Engineer in 809233022

Mainline Clang fixes usually find their way into Xcode eventually. If you want to make sure that happens, I recommend that you file a bug about this issue specifically.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Mainline Clang fixes usually find their way into Xcode eventually. If you want to make sure that happens, I recommend that you file a bug about this issue specifically.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi ! Thanks for the response, I just opened a bug report : FB15513030

Xcode 16's clang : failure to recognise function type for static member function template in class template
 
 
Q