diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-05-06 14:02:09 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-05-06 14:02:09 +0000 |
commit | d219f3ff2f12960bf2d2e2197312318696c21d9e (patch) | |
tree | 0ab36aa0f33c5ca813c56d1a9a62c9e8ddf58787 /gcc | |
parent | 5b0f0db6d9533eed15c6868a5f57d92196e3264f (diff) | |
download | gcc-d219f3ff2f12960bf2d2e2197312318696c21d9e.zip gcc-d219f3ff2f12960bf2d2e2197312318696c21d9e.tar.gz gcc-d219f3ff2f12960bf2d2e2197312318696c21d9e.tar.bz2 |
typeck.c (build_unary_op): Deal with const qualifier in invalid pointer-to-member earlier.
* typeck.c (build_unary_op): Deal with const qualifier in
invalid pointer-to-member earlier.
From-SVN: r66522
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 40a4de1..15ca7a6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-06 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + * typeck.c (build_unary_op): Deal with const qualifier in + invalid pointer-to-member earlier. + 2003-05-05 Jason Merrill <jason@redhat.com> PR c++/9537 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 35073dc..20e602a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4430,26 +4430,27 @@ build_unary_op (code, xarg, noconvert) We could defer this in non-MS mode, but it's easier to give a useful error here. */ - tree base = TREE_TYPE (TREE_OPERAND (arg, 0)); + /* Inside constant member functions, the `this' pointer + contains an extra const qualifier. TYPE_MAIN_VARIANT + is used here to remove this const from the diagnostics + and the created OFFSET_REF. */ + tree base = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg, 0))); tree name = DECL_NAME (get_first_fn (TREE_OPERAND (arg, 1))); if (! flag_ms_extensions) { - /* Inside constant member functions, the `this' pointer - contains an extra const qualifier. TYPE_MAIN_VARIANT - is used here to remove this const from the diagnostics. */ if (current_class_type && TREE_OPERAND (arg, 0) == current_class_ref) /* An expression like &memfn. */ pedwarn ("ISO C++ forbids taking the address of an unqualified" " or parenthesized non-static member function to form" " a pointer to member function. Say `&%T::%D'", - TYPE_MAIN_VARIANT (base), name); + base, name); else pedwarn ("ISO C++ forbids taking the address of a bound member" " function to form a pointer to member function." " Say `&%T::%D'", - TYPE_MAIN_VARIANT (base), name); + base, name); } arg = build_offset_ref (base, name); } |