Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.cc

    rafc1045 r0cb1d61  
    511511        }
    512512
    513         bool Indexer::hasIncompatibleCDecl( const std::string &id, const std::string &mangleName ) const {
     513        bool Indexer::hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const {
    514514                if ( ! tables ) return false;
     515                if ( tables->scope < scope ) return false;
    515516
    516517                IdTable::const_iterator decls = tables->idTable.find( id );
     
    524525                }
    525526
    526                 return tables->base.hasIncompatibleCDecl( id, mangleName );
     527                return tables->base.hasIncompatibleCDecl( id, mangleName, scope );
    527528        }
    528529       
     
    617618                DeclarationWithType *existing = lookupIdAtScope( name, mangleName, scope );
    618619                if ( ! existing || ! addedIdConflicts( existing, decl ) ) {
    619                         // this ensures that no two declarations with the same unmangled name both have C linkage
    620                         if ( decl->get_linkage() == LinkageSpec::C && hasIncompatibleCDecl( name, mangleName ) ) {
     620                        // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage
     621                        if ( decl->get_linkage() == LinkageSpec::C && hasIncompatibleCDecl( name, mangleName, scope ) ) {
    621622                                throw SemanticError( "invalid overload of C function ", decl );
    622623                        } // NOTE this is broken in Richard's original code in such a way that it never triggers (it
     
    783784            using std::cerr;
    784785
    785             cerr << "===idTable===" << std::endl;
    786             if ( tables ) dump( tables->idTable, os );
    787             cerr << "===typeTable===" << std::endl;
    788             if ( tables ) dump( tables->typeTable, os );
    789             cerr << "===structTable===" << std::endl;
    790             if ( tables ) dump( tables->structTable, os );
    791             cerr << "===enumTable===" << std::endl;
    792             if ( tables ) dump( tables->enumTable, os );
    793             cerr << "===unionTable===" << std::endl;
    794             if ( tables ) dump( tables->unionTable, os );
    795             cerr << "===contextTable===" << std::endl;
    796             if ( tables ) dump( tables->traitTable, os );
     786                if ( tables ) {
     787                        os << "--- scope " << tables->scope << " ---" << std::endl;
     788
     789                        os << "===idTable===" << std::endl;
     790                        dump( tables->idTable, os );
     791                        os << "===typeTable===" << std::endl;
     792                        dump( tables->typeTable, os );
     793                        os << "===structTable===" << std::endl;
     794                        dump( tables->structTable, os );
     795                        os << "===enumTable===" << std::endl;
     796                        dump( tables->enumTable, os );
     797                        os << "===unionTable===" << std::endl;
     798                        dump( tables->unionTable, os );
     799                        os << "===contextTable===" << std::endl;
     800                        dump( tables->traitTable, os );
     801
     802                        tables->base.print( os, indent );
     803                } else {
     804                        os << "--- end ---" << std::endl;
     805                }
     806               
    797807        }
    798808} // namespace SymTab
Note: See TracChangeset for help on using the changeset viewer.