Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r095b99a r98538288  
    311311                        Stats::Heap::newPass("validate-A");
    312312                        Stats::Time::BlockGuard guard("validate-A");
     313                        VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    313314                        acceptAll( translationUnit, hoistDecls );
    314315                        ReplaceTypedef::replaceTypedef( translationUnit );
     
    336337                        Stats::Time::BlockGuard guard("validate-C");
    337338                        acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes_old
    338                         VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    339339                        ReturnChecker::checkFunctionReturns( translationUnit );
    340340                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     
    11821182                if ( CodeGen::isCtorDtorAssign( funcDecl->get_name() ) ) { // TODO: also check /=, etc.
    11831183                        if ( params.size() == 0 ) {
    1184                                 SemanticError( funcDecl, "Constructors, destructors, and assignment functions require at least one parameter " );
     1184                                SemanticError( funcDecl->location, "Constructors, destructors, and assignment functions require at least one parameter." );
    11851185                        }
    11861186                        ReferenceType * refType = dynamic_cast< ReferenceType * >( params.front()->get_type() );
    11871187                        if ( ! refType ) {
    1188                                 SemanticError( funcDecl, "First parameter of a constructor, destructor, or assignment function must be a reference " );
     1188                                SemanticError( funcDecl->location, "First parameter of a constructor, destructor, or assignment function must be a reference." );
    11891189                        }
    11901190                        if ( CodeGen::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
    1191                                 SemanticError( funcDecl, "Constructors and destructors cannot have explicit return values " );
     1191                                if(!returnVals.front()->get_type()->isVoid()) {
     1192                                        SemanticError( funcDecl->location, "Constructors and destructors cannot have explicit return values." );
     1193                                }
    11921194                        }
    11931195                }
Note: See TracChangeset for help on using the changeset viewer.