- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/EnumAndPointerDecay.cpp
rc92bdcc r85855b0 47 47 new ast::EnumInstType( decl, ast::CV::Const ) ) ); 48 48 } else if ( auto value = member.as<ast::InlineMemberDecl>() ) { 49 if ( auto targetEnum = symtab.lookupEnum( value->name ) ) { 50 for ( auto enumMember : targetEnum->members ) { 51 auto enumObject = enumMember.strict_as<ast::ObjectDecl>(); 52 buffer.push_back( new ast::ObjectDecl( 53 // Get the location from the "inline" declaration. 54 value->location, 55 enumObject->name, 56 // Construct a new EnumInstType as the type. 57 new ast::EnumInstType( decl, ast::CV::Const ), 58 enumObject->init, 59 enumObject->storage, 60 enumObject->linkage, 61 enumObject->bitfieldWidth, 62 {}, 63 enumObject->funcSpec 64 ) ); 65 } 49 auto targetEnum = symtab.lookupEnum( value->name ); 50 // assert( targetEnum ); 51 if (!targetEnum) { 52 SemanticError(value, "Only another enum is allowed for enum inline syntax "); 53 } 54 const ast::EnumInstType * instType = new ast::EnumInstType(targetEnum); 55 mut->inlinedDecl.push_back( std::move(instType) ); 56 for ( auto enumMember : targetEnum->members ) { 57 auto enumObject = enumMember.strict_as<ast::ObjectDecl>(); 58 buffer.push_back(new ast::ObjectDecl( 59 // Get the location from the "inline" declaration. 60 value->location, 61 enumObject->name, 62 // Construct a new EnumInstType as the type. 63 new ast::EnumInstType( decl, ast::CV::Const ), 64 enumObject->init, 65 enumObject->storage, 66 enumObject->linkage, 67 enumObject->bitfieldWidth, 68 {}, 69 enumObject->funcSpec 70 )); 66 71 } 67 72 }
Note: See TracChangeset
for help on using the changeset viewer.