[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #10 from paolo at gcc dot gnu dot org 2007-09-02 13:02 --- Subject: Bug 33208 Author: paolo Date: Sun Sep 2 13:02:31 2007 New Revision: 128025 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=128025 Log: /cp 2007-09-02 Paolo Carlini [EMAIL PROTECTED] PR c++/33208 * typeck.c (build_unary_op): Fix error message for Boolean expression as operand to operator--. /testsuite 2007-09-02 Paolo Carlini [EMAIL PROTECTED] PR c++/33208 * g++.dg/other/error18.C: New. * g++.dg/expr/bitfield3.C: Adjust. Added: trunk/gcc/testsuite/g++.dg/other/error18.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/expr/bitfield3.C -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #11 from pcarlini at suse dot de 2007-09-02 13:03 --- Fixed. -- pcarlini at suse dot de changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #1 from pinskia at gcc dot gnu dot org 2007-09-01 20:03 --- Confirmed. The problem is obvious: error (invalid use of %--% on bool variable %qD, arg); %qD should be %qE. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added CC||pinskia at gcc dot gnu dot ||org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2007-09-01 20:03:14 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #2 from pcarlini at suse dot de 2007-09-01 20:52 --- But do we really want 'a.A::b' ?!? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #3 from pinskia at gcc dot gnu dot org 2007-09-01 21:01 --- (In reply to comment #2) But do we really want 'a.A::b' ?!? Well the error message needs rewording also. Something like: invalid use of %--% on bool lvalue %qE -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #4 from gdr at cs dot tamu dot edu 2007-09-01 21:07 --- Subject: Re: Broken diagnostic: 'component_ref' not supported by dump_decl pcarlini at suse dot de [EMAIL PROTECTED] writes: | But do we really want 'a.A::b' ?!? No, we don't. The format specific is OK -- e.g. it should be %qD. However, the caller of error() should make sure it gives a _DECL. It isn't really the diagnostic machinery's business here to second guess a type error correction. Of course, it would have been better if we had diagnostics with carret... -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #5 from pcarlini at suse dot de 2007-09-01 21:11 --- Thanks Gaby, let's see what I can do... -- pcarlini at suse dot de changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de |dot org | Status|NEW |ASSIGNED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #6 from pinskia at gcc dot gnu dot org 2007-09-01 21:12 --- Another testcase: void f(bool *b) { (*b)--; } And another one: bool g(void); void f(bool *b) { g()--; } So variable in the error message does not make sense at all. We want to use lvalue instead. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #7 from pinskia at gcc dot gnu dot org 2007-09-01 21:15 --- (In reply to comment #4) | But do we really want 'a.A::b' ?!? No, we don't. The format specific is OK -- e.g. it should be %qD. However, the caller of error() should make sure it gives a _DECL. It isn't really the diagnostic machinery's business here to second guess a type error correction. Actually variable a or variable b does not make sense here, we really want to use the word lvalue instead of variable as shown by my other two testcases. Yes I know it is not the diagnostic machinery's business here to second guess a type error correction but I am saying we need to change the error message fully. We should not be using variable %qD when we can get any kind of lvalues here. -- Pinski -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #8 from gdr at cs dot tamu dot edu 2007-09-01 21:59 --- Subject: Re: Broken diagnostic: 'component_ref' not supported by dump_decl pinskia at gcc dot gnu dot org [EMAIL PROTECTED] writes: | Another testcase: | void f(bool *b) | { | (*b)--; | } | | And another one: | bool g(void); | | void f(bool *b) | { | g()--; | } Interesting testcase. This makes me revise my previous opinion to: we should not use any of the format specifier at all -- not %qD, not %qE. | So variable in the error message does not make sense at all. We want to use | lvalue instead. What has this to do with lvalue? I believe the restriction is that, it just does not make any sense to decrement a bool -- be it an lvalue or an rvalue. Paolo, what about error (invalid use of Boolean expression as operand to %operator--%) ? -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208
[Bug c++/33208] Broken diagnostic: 'component_ref' not supported by dump_decl
--- Comment #9 from pcarlini at suse dot de 2007-09-01 22:14 --- (In reply to comment #8) Paolo, what about error (invalid use of Boolean expression as operand to %operator--%) ? Cetainly works for me... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33208