KhronosGroup / KhronosGroup/glslang

invalid arithmetic between different enumeration types

Open
#4,033 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.6k
Forks
989
Avg merge
1d 2h
Merged PRs (30d)
31

Description

While compiling with c++26, I am seeing the error:

glslang/glslang/MachineIndependent/ParseHelper.cpp:10361:108: error: invalid arithmetic between different enumeration types ('TLayoutPacking' and 'TLayoutMatrix')
10361 | size_t originMemberHash = hasher(originType->getStruct()->at(i).type->getQualifier().layoutPacking +
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
10362 | originType->getStruct()->at(i).type->getQualifier().layoutMatrix);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

glslang/glslang/MachineIndependent/ParseHelper.cpp:10363:102: error: invalid arithmetic between different enumeration types ('TLayoutPacking' and 'TLayoutMatrix')
10363 | size_t tmpMemberHash = hasher(tmpType->getStruct()->at(i).type->getQualifier().layoutPacking +
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
10364 | tmpType->getStruct()->at(i).type->getQualifier().layoutMatrix);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Contributor guide

Open the contributing guide

Research direction

Start in glslang/glslang/MachineIndependent/ParseHelper.cpp around lines 10361-10364, where the member hashes add TLayoutPacking and TLayoutMatrix values. Reproduce the diagnostic with a C++26 build, then verify the affected code compiles without the invalid-enumeration-arithmetic errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.