Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    r4894239 r92355883  
    988988                        }
    989989                };
    990 
    991                 struct ResolveDesignators_new final : public ast::WithShortCircuiting {
    992                         ResolveContext& context;
    993                         bool result = false;
    994 
    995                         ResolveDesignators_new( ResolveContext& _context ): context{_context} {};
    996 
    997                         void previsit( const ast::Node * ) {
    998                                 // short circuit if we already know there are designations
    999                                 if ( result ) visit_children = false;
    1000                         }
    1001 
    1002                         void previsit( const ast::Designation * des ) {
    1003                                 if ( result ) visit_children = false;
    1004                                 else if ( ! des->designators.empty() ) {
    1005                                         if ( (des->designators.size() == 1) ) {
    1006                                                 const ast::Expr * designator = des->designators.at(0);
    1007                                                 if ( const ast::NameExpr * designatorName = dynamic_cast<const ast::NameExpr *>(designator) ) {
    1008                                                         auto candidates = context.symtab.lookupId(designatorName->name);
    1009                                                         for ( auto candidate : candidates ) {
    1010                                                                 if ( dynamic_cast<const ast::EnumInstType *>(candidate.id->get_type()) ) {
    1011                                                                         result = true;
    1012                                                                         break;
    1013                                                                 }
    1014                                                         }
    1015                                                 }
    1016                                         }
    1017                                         visit_children = false;
    1018                                 }
    1019                         }
    1020                 };
    1021990        } // anonymous namespace
    1022991        /// Check if this expression is or includes a deleted expression
     
    15381507                                if ( InitTweak::tryConstruct( mutDecl ) && ( managedTypes.isManaged( mutDecl ) || ((! isInFunction() || mutDecl->storage.is_static ) && ! InitTweak::isConstExpr( mutDecl->init ) ) ) ) {
    15391508                                        // constructed objects cannot be designated
     1509                                        // if ( InitTweak::isDesignated( mutDecl->init ) ) SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
    15401510                                        if ( InitTweak::isDesignated( mutDecl->init ) ) {
    1541                                                 ast::Pass<ResolveDesignators_new> res( context );
    1542                                                 maybe_accept( mutDecl->init.get(), res );
    1543                                                 if ( !res.core.result ) {
    1544                                                         SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
    1545                                                 }
     1511                                                SemanticError( mutDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );
    15461512                                        }
    15471513                                        // constructed objects should not have initializers nested too deeply
Note: See TracChangeset for help on using the changeset viewer.