Open nico opened 8 years ago
Both compilers are right; there are two points of instantiation for min
, and we pick the first one if it's constexpr
.
(The constexpr
version compiles if I add
struct A;
inline bool operator<(const A&, const A&);
between the definition of min()
and struct A
, so I can probably use that as a workaround for now. But it'd be good to know if this is intentional, and if so, to get a better diagnostic.)
Extended Description
Consider this:
This builds fine. Now make
max()
constexpr
:cl.exe
builds this fine, and that's how it implementsstd::min()
.a) Who is right?
b) If it's clang, we need to figure out what
cl.exe
does and accept that as an extension.(Also, the diagnostic is not very good.)