Issue 181448
Summary Clang produces different result for Full template specialization
Labels clang
Assignees
Reporter ranaanoop
    The following program produces `0` in clang while `1` in gcc and msvc irrespective of whether you use `=delete` or `{}` when defining the `format` function template. [Demo with `=delete`](https://godbolt.org/z/Wz58Pr8fT) and [Demo without `=delete`](https://godbolt.org/z/8cYnTKhe7) 

```
#include <iostream>
#include <type_traits>
#include <utility>

namespace my_namespace {

template <typename T>
void format(std::ostream& os, const T& t) =delete; //replacing =delete with {} still produces 0 in clang 

template <typename T, class = void>
struct is_formattable : std::false_type { };

template <typename T>
struct is_formattable<T, decltype(format<T>(std::declval<std::ostream&>(), std::declval<const T&>()), void { })> : std::true_type { };

}

struct S {
    int a;
};

namespace my_namespace {

template <>
void format<::S>(std::ostream& os, const ::S& s)
{
    os << "S[" << s.a << ']';
}

}

int main() { std::cout << my_namespace::is_formattable<S>::value << '\n'; }
 
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to