This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16518] New: mutable specifier only applies to first item in declaration list


Consider 't.cpp': 
 
struct foo { 
        void bar() const { m1=1; m2=1;} 
        mutable int m1,m2; 
}; 
 
Compilation (g++ -c t.cpp) gives: 
 
t.cpp: In member function `void foo::bar() const': 
t.cpp:3: error: assignment of data-member `foo::m2' in read-only structure 
 
This shows that the mutable specifier applies only to the first item in the 
declaration list. Is this the correct behaviour? With previous gcc-versions 
both m1 and m2 were considered mutable and this would compile without problems. 
There is no mention of a change in wwwdocs/htdocs/gcc-3.5/changes.html. I am 
not a native Legalese speaker, so 7.1.1(1) wasn't of much help.

-- 
           Summary: mutable specifier only applies to first item in
                    declaration list
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan at etpmod dot phys dot tue dot nl
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-suse-linux
  GCC host triplet: i686-suse-linux
GCC target triplet: i686-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16518


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]