Topic: warning: 'this' : used in base member


Author: stephen.clamage@Sun.COM (Steve Clamage)
Date: 1998/05/28
Raw View
In article 1@nnrp1.dejanews.com, A.Stokes@globalcomm.co.uk writes:
>In article <6k49v6$7hr@engnews1.Eng.Sun.COM>,
>  clamage@Eng wrote:
>....
>> It's quite reasonable for the compiler to warn about passing "this"
>> to a base class, since you've opened the door to a bug that might
>> be hard to track down.
>
>Isn't this actually ill-formed, or possibly just undefined, and isn't the
>diagnostic required? The FDIS defines the meaning of 'this' in the body of a
>nonstatic member function (9.3.2, [class.this]), but that doesn't include a
>constructor member/base initialiser list.

No. Section 5.1 "Primary expressions" paragraph 3 says explicitly that
"this" may appear in a member/base initializer list.

---
Steve Clamage, stephen.clamage@sun.com
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]