Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r843054c2 r367e082  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:50:04 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 16:50:09 2015
    13 // Update Count     : 3
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Mon May 25 14:27:15 2015
     13// Update Count     : 21
    1414//
    1515
     
    560560                for ( std::list< Declaration * >::const_iterator member = aggregateDecl->get_members().begin(); member != aggregateDecl->get_members().end(); ++member ) {
    561561                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ) ) {
     562                                // query the type qualifiers of this field and skip assigning it if it is marked const.
     563                                // If it is an array type, we need to strip off the array layers to find its qualifiers.
     564                                Type * type = dwt->get_type();
     565                                while ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     566                                        type = at->get_base();
     567                                }
     568
     569                                if ( type->get_qualifiers().isConst ) {
     570                                        // don't assign const members
     571                                        continue;
     572                                }
     573
    562574                                if ( ArrayType *array = dynamic_cast< ArrayType * >( dwt->get_type() ) ) {
    563575                                        makeArrayAssignment( srcParam, dstParam, dwt, array, back_inserter( assignDecl->get_statements()->get_kids() ) );
Note: See TracChangeset for help on using the changeset viewer.