Skip to content

Commit

Permalink
GCC 7.5 errors in WriteSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed May 17, 2021
1 parent 9786b35 commit 93a222c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Source/Core/VideoCommon/UberShaderCommon.h
Expand Up @@ -39,12 +39,15 @@ std::string BitfieldExtract(std::string_view source)
static_cast<u32>(BitFieldT::NumBits()));
}

template <auto last_member>
template <auto last_member, typename = decltype(last_member)>
void WriteSwitch(ShaderCode& out, APIType ApiType, std::string_view variable,
const EnumMap<std::string_view, last_member>& values, int indent, bool break_)
{
const bool make_switch = (ApiType == APIType::D3D);

// The second template argument is needed to avoid compile errors from ambiguity with multiple
// enums with the same number of members in GCC prior to 8. See https://godbolt.org/z/xcKaW1seW
// and https://godbolt.org/z/hz7Yqq1P5
using enum_type = decltype(last_member);

// {:{}} is used to indent by formatting an empty string with a variable width
Expand Down

0 comments on commit 93a222c

Please sign in to comment.