https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102653
Bug ID: 102653
Summary: operator* doesn't work for enum classes
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: woweric at live dot com
Target Milestone: ---
enum class TextWrap {NONE = 0, DOWN = 1, UP = -1};
int main()
{
TextWrap wrap = TextWrap::NONE;
int num = 20 * wrap;
}
gives the error:
test.cpp:6:18: error: no match for 'operator*' (operand types are 'int' and
'TextWrap')
but the following code compiles fine:
enum TextWrap {NONE = 0, DOWN = 1, UP = -1};
int main()
{
TextWrap wrap = NONE;
int num = 20 * wrap;
}