Post

Replies

Boosts

Views

Activity

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
2
0
4.2k
Oct ’24