'absl::FormatSpec results in ambiguous function call under clang

Under Clang, the following code gives me an ambiguous function call error:

#include "absl/strings/str_format.h"

struct Foo {};

template<typename... Args>
void func(absl::FormatSpec<Args...> format, const Args&... args) {}

template<typename... Args>
void func(Foo, absl::FormatSpec<Args...> format, const Args&... args) {}

int main()
{    
    func("%s", "Hello");
    func(Foo{}, absl::string_view{"Test"});
}

I'm trying to understand why Clang can not determine that it should call the func that is overloaded to explicitly accept Foo as its first argument, whereas GCC can.

There's a Godbolt link here.

c++


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source