This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29348] Ambiguous warning with -Weffc++
- From: "federico dot carminati at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Oct 2006 05:10:23 -0000
- Subject: [Bug c++/29348] Ambiguous warning with -Weffc++
- References: <bug-29348-10286@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from federico dot carminati at cern dot ch 2006-10-05 05:10 -------
Subject: Re: Ambiguous warning with -Weffc++
First of all a user can implement the correct behaviour, evaluating
just the first member and returning if true, continuing if false.
Second, the compiler tells me that I am evaluating the two members
when it has no way to tell this just by looking at the declaration of
the operator. So the warning is at best not justified when referring
only to the declaration, at worst wrong.
Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 79480
Mobile: +41 76 487 4843
On 5 Oct 2006, at 06:31, pinskia at gcc dot gnu dot org wrote:
>
>
> ------- Comment #1 from pinskia at gcc dot gnu dot org 2006-10-05
> 04:31 -------
> effcpp01.cxx:3: warning: user-defined 'a a::operator||(const a&)'
> always
> evaluates both arguments
>
> I don't see why this is ambiguous. Because normally || is short
> ciruting in
> that if the left hand side is true the other side is not
> evaluated. And it is
> has nothing to do with optimization but rather correct behavior.
> so with user defined operator||, you have to evaluate both sides
> which is
> different than the default behavior which then could cause
> different behavior.
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29348
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29348