public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61940] New: Wrong error location for error in initialization list
@ 2014-07-29  0:22 martin at steghoefer dot eu
  2014-07-29  4:14 ` [Bug c++/61940] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: martin at steghoefer dot eu @ 2014-07-29  0:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

            Bug ID: 61940
           Summary: Wrong error location for error in initialization list
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: martin at steghoefer dot eu

Created attachment 33199
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33199&action=edit
Example that provokes an error message with a wrong location

When using several initializers in a constructor initializer list, an error in
one of the initializers (e.g. a conversion from a const pointer to a non-const
pointer, like in the attached example) is reported by gcc on the last token of
the *whole* initializer list (not the last token of the erroneous initializer).

This behavior is independent of the erroneous initializer being a member
initialization or a call to a super-class constructor.


Reproduce:
g++ gcc-wrong-error-location.ii

Output:
gcc-wrong-error-location.cxx: In constructor ‘Class::Class(const double*)’:
gcc-wrong-error-location.cxx:13:19: error: invalid conversion from ‘const
double*’ to ‘double*’ [-fpermissive]
   m_otherMemberB(1)                 // good initialization (shown as erroneous
line)
                   ^


gcc version:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
>From gcc-bugs-return-457276-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 29 01:44:58 2014
Return-Path: <gcc-bugs-return-457276-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28782 invoked by alias); 29 Jul 2014 01:44:57 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 28349 invoked by uid 48); 29 Jul 2014 01:44:42 -0000
From: "thiago at kde dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61941] New: Mis-parsing of warn_unused_result function with ref-qualifiers
Date: Tue, 29 Jul 2014 01:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: thiago at kde dot org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-61941-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg01867.txt.bz2
Content-length: 1613

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61941

            Bug ID: 61941
           Summary: Mis-parsing of warn_unused_result function with
                    ref-qualifiers
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot org

Testcase:

====
class S
{
public:
    S x() const __attribute__ ((__warn_unused_result__));

    S y() const & __attribute__ ((__warn_unused_result__));
    S y() && __attribute__ ((__warn_unused_result__));
};
====
(Almost minimal testcase; remove the last
__attribute__((__warn_unused_result__)) for truly minimal)

When compiled produces the following output:
test.ii:7:7: error: ‘S S::y() &&’ cannot be overloaded
     S y() && __attribute__ ((__warn_unused_result__));
       ^
test.ii:6:7: error: with ‘S S::y() const’
     S y() const & __attribute__ ((__warn_unused_result__));
       ^

Tested with GCC 4.8.1 (openSUSE 13.1) and 4.9.2 (gcc-4_8-branch revision
213070).

If you read only the error message, it is correct: "S::y() &&" cannot be
overloaded with "S::y() const". However. the overload of y on line 6 that GCC
complains about is actually "S::y() const &", which is allowed to be
overloaded. Somehow the & ref-qualifier got lost in the parsing.

The error does not depend on the order of lines 6 and 7. It does depend on
S::x() const appearing before S::y() const & and that both functions have the
attribute.
>From gcc-bugs-return-457277-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 29 02:47:12 2014
Return-Path: <gcc-bugs-return-457277-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13702 invoked by alias); 29 Jul 2014 02:47:02 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13056 invoked by uid 48); 29 Jul 2014 02:46:03 -0000
From: "zhenqiang.chen at linaro dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59837] [ARM] ICE when building linux-linaro-tracking
Date: Tue, 29 Jul 2014 02:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zhenqiang.chen at linaro dot org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59837-4-KoFwLi1VM0@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59837-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59837-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg01868.txt.bz2
Content-length: 341

https://gcc.gnu.org/bugzilla/show_bug.cgi?idY837

zhenqiang.chen at linaro dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/61940] Wrong error location for error in initialization list
  2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
@ 2014-07-29  4:14 ` mpolacek at gcc dot gnu.org
  2015-04-22 11:57 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-07-29  4:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-29
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.10.0
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, taking.  (Such a fix is not going to be backported to 4.8/4.9
branches though.)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/61940] Wrong error location for error in initialization list
  2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
  2014-07-29  4:14 ` [Bug c++/61940] " mpolacek at gcc dot gnu.org
@ 2015-04-22 11:57 ` jakub at gcc dot gnu.org
  2015-05-12 16:27 ` tromey at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 11:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/61940] Wrong error location for error in initialization list
  2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
                   ` (2 preceding siblings ...)
  2015-05-12 16:27 ` tromey at gcc dot gnu.org
@ 2015-05-12 16:27 ` tromey at gcc dot gnu.org
  2015-07-16  9:15 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu.org @ 2015-05-12 16:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat dot com

--- Comment #4 from Tom Tromey <tromey at gcc dot gnu.org> ---
*** Bug 59621 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/61940] Wrong error location for error in initialization list
  2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
  2014-07-29  4:14 ` [Bug c++/61940] " mpolacek at gcc dot gnu.org
  2015-04-22 11:57 ` jakub at gcc dot gnu.org
@ 2015-05-12 16:27 ` tromey at gcc dot gnu.org
  2015-05-12 16:27 ` tromey at gcc dot gnu.org
  2015-07-16  9:15 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at gcc dot gnu.org @ 2015-05-12 16:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

Tom Tromey <tromey at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |akim.demaille at gmail dot com

--- Comment #3 from Tom Tromey <tromey at gcc dot gnu.org> ---
*** Bug 53553 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/61940] Wrong error location for error in initialization list
  2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
                   ` (3 preceding siblings ...)
  2015-05-12 16:27 ` tromey at gcc dot gnu.org
@ 2015-07-16  9:15 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61940

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-16  9:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29  0:22 [Bug c++/61940] New: Wrong error location for error in initialization list martin at steghoefer dot eu
2014-07-29  4:14 ` [Bug c++/61940] " mpolacek at gcc dot gnu.org
2015-04-22 11:57 ` jakub at gcc dot gnu.org
2015-05-12 16:27 ` tromey at gcc dot gnu.org
2015-05-12 16:27 ` tromey at gcc dot gnu.org
2015-07-16  9:15 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).