This is the mail archive of the gcc-help@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] |
Using gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5), I have a C++ class CFoo that doesn't define an operator[] member function and has no base classes. But use of [] is allowed by the compiler, like this:
CFoo foo; CFoo test; test = foo[0]; foo[0] = 0;
Both assignment statements seem illegal to me but cause no errors. I cannot post the class itself because it contains sensitive information.
Can anyone explain what's going on here? Specifically, is this a compiler bug, or are implicit operator[] member functions sometimes generated by the compiler and under what rules? Thanks for your attention.
-- Marc Glisse
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |