Changeset 7f18438 for src/Parser


Ignore:
Timestamp:
Aug 5, 2024, 3:34:05 PM (14 hours ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
830edc6
Parents:
f6d2e9b
Message:

Add "implicit case to base type" to enumerator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cpp

    rf6d2e9b r7f18438  
    14741474                        SemanticError( td->location, "Opague cannot have an explicit initializer value." );
    14751475                } else if ( cur->has_enumeratorValue() ) {
     1476                        ast::Expr * initValue;
     1477                        if (ret->isCfa && ret->base) {
     1478                                initValue = new ast::CastExpr( cur->enumeratorValue->location, maybeMoveBuild( cur->consume_enumeratorValue() ), ret->base  );
     1479                        } else {
     1480                                initValue = maybeMoveBuild( cur->consume_enumeratorValue() );
     1481                        }
    14761482                        object->init = new ast::SingleInit(
    14771483                                td->location,
    1478                                 maybeMoveBuild( cur->consume_enumeratorValue() ),
     1484                                initValue,
    14791485                                ast::NoConstruct
    14801486                        );
Note: See TracChangeset for help on using the changeset viewer.