This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: [Bug libstdc++/29286] [4.0/4.1/4.2 Regression] placement new does not change the dynamic type as it should
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: gcc-bugzilla at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: 24 Oct 2006 08:42:45 +0200
- Subject: Re: [Bug libstdc++/29286] [4.0/4.1/4.2 Regression] placement new does not change the dynamic type as it should
- References: <bug-29286-10053@http.gcc.gnu.org/bugzilla/> <20061004053936.9325.qmail@sourceware.org>
"mark at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Comment #22 from mark at codesourcery dot com 2006-10-04 05:39 -------
| Subject: Re: [4.0/4.1/4.2 Regression] placement new
| does not change the dynamic type as it should
|
| ian at airs dot com wrote:
| > ------- Comment #21 from ian at airs dot com 2006-10-03 23:44 -------
| > In C a general allocation function should work with a char array. A specific
| > allocation function should use a union. I don't think there are many existing
| > exceptions to these guidelines.
|
| > So I don't see a serious problem in C either. Am I missing something/
|
| I think there are two remaining issues:
|
| int i;
| *(float*)(&i) = 7.0;
|
| IIUC, Mike's position is that this is valid -- and that, in fact, after
| this point "i" can no longer be accessed as an int. Do you agree?
I don't see how that code is supported by the paragraphs quoted by Mike.
There was a recent discussion (at most two weeks ago) on the C++
standard reflector -core about similar topic. I do agree with Mark
that the proper way to resolve this is to go to the C++ committee.
It would be incredible that C++ was less type-strict than C.
-- Gaby