Changeset 5668740 for src/AST/Decl.cpp
- Timestamp:
- Jun 14, 2023, 11:35:49 AM (13 months ago)
- Branches:
- master
- Children:
- 7e4bd9b6
- Parents:
- 32a4f3e (diff), 8f557161 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r32a4f3e r5668740 142 142 bool EnumDecl::valueOf( const Decl * enumerator, long long& value ) const { 143 143 if ( enumValues.empty() ) { 144 long long crntVal = 0;144 Evaluation crntVal = {0, true, true}; // until expression is given, we know to start counting from 0 145 145 for ( const Decl * member : members ) { 146 146 const ObjectDecl* field = strict_dynamic_cast< const ObjectDecl* >( member ); 147 147 if ( field->init ) { 148 148 const SingleInit * init = strict_dynamic_cast< const SingleInit* >( field->init.get() ); 149 auto result= eval( init->value );150 if ( ! result.second) {149 crntVal = eval( init->value ); 150 if ( ! crntVal.isEvaluableInGCC ) { 151 151 SemanticError( init->location, ::toString( "Non-constexpr in initialization of " 152 152 "enumerator: ", field ) ); 153 153 } 154 crntVal = result.first;155 154 } 156 155 if ( enumValues.count( field->name ) != 0 ) { 157 156 SemanticError( location, ::toString( "Enum ", name, " has multiple members with the " "name ", field->name ) ); 158 157 } 159 enumValues[ field->name ] = crntVal; 160 ++crntVal; 158 if (crntVal.hasKnownValue) { 159 enumValues[ field->name ] = crntVal.knownValue; 160 } 161 ++crntVal.knownValue; 161 162 } 162 163 }
Note: See TracChangeset
for help on using the changeset viewer.