A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/54443 below:

Clang applies constraint checking loosely in variable declaration with concepts · Issue #54443 · llvm/llvm-project · GitHub

The following code compiled with Clang, but not with GCC or MSVC:

template <class T, class U>
struct is_same { static constexpr bool value = false; };

template <class T>
struct is_same<T, T> { static constexpr bool value = true; };

template <class T, class U>
concept same_as = is_same<T, U>::value;

int const& f();

same_as<int const&> auto& i = f();

Both GCC and MSVC complain that the constraint same_as<int const&> is not satisfied, but Clang accepts it. If we change to same_as<int const> auto& i = f();, then GCC and MSVC accept it, and Clang accepts it too, which is really weird!

Godbolt: https://godbolt.org/z/q5K9885vb


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4