Compiler ambiguity in enum-utils.h on operator overloading
Hi,
When trying to build GJS master on Visual Studio, I noticed a few things:
-
Visual Studio 2019 is now required, as 2017 could not cope with the
js_value_to_c()
implementations injs-value-inl.h
without triggering the default implementation that is specifically disallowed (with the= delete
marking), without the/permissive
flag. -
Visual Studio 2017 cannot cope with the operator overloads in
enum-utils.h
without facing ambiguity errors, even with/permissive
enabled. Visual Studio 2019 can cope with this, but only with/permissive
enabled. The errors that I came across were like the following:
d:\git_repos\gjs\gjs/enum-utils.h(41): error C2593: 'operator &' is ambiguous
d:\git_repos\gjs\gjs/enum-utils.h(42): note: could be 'built-in C++ operator&(int, int)'
d:\git_repos\gjs\gjs/enum-utils.h(42): note: or 'built-in C++ operator&(int, EnumType)'
with
[
EnumType=GjsArgumentFlags
]
d:\git_repos\gjs\gjs/enum-utils.h(42): note: or 'built-in C++ operator&(EnumType, int)'
with
[
EnumType=GjsArgumentFlags
]
d:\git_repos\gjs\gjs/enum-utils.h(42): note: or 'built-in C++ operator&(EnumType, EnumType)'
with
[
EnumType=GjsArgumentFlags
]
d:\git_repos\gjs\gjs/enum-utils.h(42): note: while trying to match the argument list '(Wrapped, Wrapped)'
with
[
Wrapped=GjsEnum::WrapperImpl<GjsArgumentFlags>
]
../git_repos/gjs/gi/arg.cpp(1102): note: see reference to function template instantiation 'GjsEnum::WrapperImpl<EnumType> operator &<GjsArgumentFlags,GjsEnum::WrapperImpl<EnumType>>(const EnumType &,const EnumType &)' being compiled
with
[
EnumType=GjsArgumentFlags
]
(Similar errors appeared for operator |
as well)
Please note that for both Visual Studio 2017 and 2019 /permissive-
is the default, meaning that for our case, we are checking against C++17 conformance more strictly. The gnome-3-38
branch builds fine on 2017 and 2019 even with /permissive-
enabled across the board.
With blessings, thank you!