Changeset 830edc6


Ignore:
Timestamp:
Aug 5, 2024, 4:42:46 PM (7 hours ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
0e6cf54c
Parents:
7f18438
Message:
  1. Add implicit const to enum base type; 2. change auto initializer to +1 (rvalue addtion)
Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypeData.cpp

    r7f18438 r830edc6  
    14541454        assert( td->kind == TypeData::Aggregate );
    14551455        assert( td->aggregate.kind == ast::AggregateDecl::Enum );
    1456         ast::Type * baseType = td->base ? typebuild(td->base) : nullptr;
     1456        ast::ptr<ast::Type> baseType = td->base ? typebuild(td->base) : nullptr;
     1457        if ( baseType ) {
     1458                ast::add_qualifiers( baseType, ast::CV::Qualifiers( ast::CV::Const ));
     1459        }
     1460
    14571461        ast::EnumDecl * ret = new ast::EnumDecl(
    14581462                td->location,
  • src/Validate/ImplementEnumFunc.cpp

    r7f18438 r830edc6  
    148148        } else {
    149149                auto untypedThisInit = new ast::UntypedExpr(
    150                         getLocation(), new ast::NameExpr(getLocation(), "?++"),
    151                         {prevInitExpr});
     150                        getLocation(), new ast::NameExpr(getLocation(), "?+?"),
     151                        {       prevInitExpr,
     152                                new ast::ConstantExpr( getLocation(), new ast::OneType, "1", 1) });
    152153                return new ast::SingleInit(getLocation(), untypedThisInit);
    153154        }
Note: See TracChangeset for help on using the changeset viewer.