aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-08-20 21:57:38 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-08-20 21:57:38 +0000
commitb61148dd4f5b244381b91b86dd7e921698f92687 (patch)
tree7fca7eb8154acbe4119ad9cc2a8c8d081dd4a9ab /gcc/c-common.c
parentf2655b99bc6217d561b0ba64e9c0e89b2ef1626d (diff)
downloadgcc-b61148dd4f5b244381b91b86dd7e921698f92687.zip
gcc-b61148dd4f5b244381b91b86dd7e921698f92687.tar.gz
gcc-b61148dd4f5b244381b91b86dd7e921698f92687.tar.bz2
* c-common.c (c_get_alias_set): Update comment.
From-SVN: r28780
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index d194be6..bcf2210 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3411,11 +3411,24 @@ c_get_alias_set (t)
`I *' are different types. So, we have to pick a canonical
representative. We do this below.
- Note that this approach is actually more conservative that it
- needs to be. In particular, `const int *' and `int *' should
- be in different alias sets, but this approach puts them in
- the same alias set. */
-
+ Technically, this approach is actually more conservative that
+ it needs to be. In particular, `const int *' and `int *'
+ chould be in different alias sets, according to the C and C++
+ standard, since their types are not the same, and so,
+ technically, an `int **' and `const int **' cannot point at
+ the same thing.
+
+ But, the standard is wrong. In particular, this code is
+ legal C++:
+
+ int *ip;
+ int **ipp = &ip;
+ const int* const* cipp = &ip;
+
+ And, it doesn't make sense for that to be legal unless you
+ can dereference IPP and CIPP. So, we ignore cv-qualifiers on
+ the pointed-to types. This issue has been reported to the
+ C++ committee. */
t = TYPE_MAIN_VARIANT (TREE_TYPE (type));
t = ((TREE_CODE (type) == POINTER_TYPE)
? build_pointer_type (t) : build_reference_type (t));