This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: const and strict aliasing rules
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: jlkjr at bioleap dot com (John L. Kulp), gcc at gcc dot gnu dot org
- Date: 05 Dec 2006 02:34:09 +0100
- Subject: Re: const and strict aliasing rules
- References: <200612050031.kB50Vo2X003463@localhost.localdomain>
Andrew Pinski <pinskia@physics.uc.edu> writes:
| >
| > Andrew Pinski <pinskia@physics.uc.edu> writes:
| >
| > | > You can work around this by using union's of pointers of both non-const
| > | > and const types, but the reinterpret_cast solution would be more attractive.
| > | >
| > | > Thoughts?
| > |
| > | This has nothing to do with const vs non-const but rather
| > | a<int> and a<const int> are two seperate types which are not related in any way.
| > | The C++ standard defines these two types as seperate types and are not compatiable
| > | in any way for aliasing.
| >
| > ???
| >
| > 3.10/15:
|
| And the template type a<int> are distict from a<const int> based on the template
| arguments are diffrent and therefore the qualifier part of 3.10/15 does not apply.
| If it was const a<int> and a<int> then it would apply.
Yes, you're right -- somehow I missed the angle brackets. Sorry.
-- Gaby