Changeset 9d5eacb for src/ResolvExpr


Ignore:
Timestamp:
Jul 10, 2024, 6:55:54 PM (8 days ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
236f133, 3be81a4
Parents:
725f777f
Message:

Fix the bug with typed anomynous enum got incorrect forward declaration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/ResolveTypeof.cpp

    r725f777f r9d5eacb  
    6161                if ( typeofType->kind == ast::TypeofType::Basetypeof ) {
    6262                        // replace basetypeof(<enum>) by int
    63                         // if ( newType.as< ast::EnumInstType >() ) {
    64                         //      newType = new ast::BasicType(
    65                         //              ast::BasicKind::SignedInt, newType->qualifiers, copy(newType->attributes) );
    66                         // }
     63                        auto enumInst = newType.as< ast::EnumInstType >();
     64                        if ( enumInst && (!enumInst->base || !enumInst->base->isCfa) ) {
     65                                newType = new ast::BasicType(
     66                                        ast::BasicKind::SignedInt, newType->qualifiers, copy(newType->attributes) );
     67                        }
    6768                        reset_qualifiers(
    6869                                newType,
Note: See TracChangeset for help on using the changeset viewer.