public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
@ 2011-12-20 16:49 ` petschy at gmail dot com
  2011-12-20 17:01 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: petschy at gmail dot com @ 2011-12-20 16:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640

--- Comment #1 from petschy at gmail dot com 2011-12-20 16:49:02 UTC ---
Created attachment 26155
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26155
a slightly more verbose test case

Extended test case with ambiguous type name in variable definition and class
declaration.


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

* [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous
@ 2011-12-20 16:49 petschy at gmail dot com
  2011-12-20 16:49 ` [Bug c++/51640] " petschy at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: petschy at gmail dot com @ 2011-12-20 16:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640

             Bug #: 51640
           Summary: Misleading error if the type in the catch() is
                    ambiguous
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: petschy@gmail.com


Created attachment 26154
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26154
test case that triggers the bug

There is a regression from g++ 4.4 in later versions. If the name of the class
is ambiguous in a catch(), this fact is not reported.

At line 25 when compiling the attached test case with 4.5.x, 4.6.x or 4.7.0,
the ambiguity of the type name 'ex2' is not mentioned.

4.4.6 reports the ambiguity at the catch(), though for other ambiguities (at
variable definition, class declaration w/ ambiguous parent) it prints the
message twice. 4.5 and above versions print the error once in these latter
cases. I suspect that this regression might be connected to fixing the
duplicated error printing.

Tested on an amd64 machine with Debian Wheezy, stock 4.4, 4.5, 4.6 versions
(4.4.6-14, 4.5.3-9, 4.6.2-7) and 4.7.0 built from svn trunk r182460.

The original cpp file is attached, since it doesn't have any preprocessor
directives except for comments.

Command line and output:

g++-r182460 -v -save-temps -Wall -Wextra -c test_gccexbug2.cpp 
Using built-in specs.
COLLECT_GCC=g++-r182460
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --program-suffix -r182460
Thread model: posix
gcc version 4.7.0 20111219 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-c' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus -E -quiet -v
-D_GNU_SOURCE test_gccexbug2.cpp -mtune=generic -march=x86-64 -Wall -Wextra
-fpch-preprocess -o test_gccexbug2.ii
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include
 /usr/local/include
 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-c' '-shared-libgcc'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus -fpreprocessed
test_gccexbug2.ii -quiet -dumpbase test_gccexbug2.cpp -mtune=generic
-march=x86-64 -auxbase test_gccexbug2 -Wall -Wextra -version -o
test_gccexbug2.s
GNU C++ (GCC) version 4.7.0 20111219 (experimental) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.0 20111218 (experimental), GMP version 5.0.2,
MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C++ (GCC) version 4.7.0 20111219 (experimental) (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.7.0 20111218 (experimental), GMP version 5.0.2,
MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: fafea236350b995726228b0b21cd1771
test_gccexbug2.cpp: In function ‘void bar()’:
test_gccexbug2.cpp:25:11: error: expected type-specifier before ‘ex2’
test_gccexbug2.cpp:25:14: error: expected ‘)’ before ‘&’ token
test_gccexbug2.cpp:25:14: error: expected ‘{’ before ‘&’ token
test_gccexbug2.cpp:25:15: error: expected primary-expression before ‘)’ token
test_gccexbug2.cpp:25:15: error: expected ‘;’ before ‘)’ token


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
  2011-12-20 16:49 ` [Bug c++/51640] " petschy at gmail dot com
@ 2011-12-20 17:01 ` redi at gcc dot gnu.org
  2012-01-04 20:45 ` petschy at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2011-12-20 17:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-20
      Known to work|                            |4.4.3
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.2, 4.6.2, 4.7.0


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
  2011-12-20 16:49 ` [Bug c++/51640] " petschy at gmail dot com
  2011-12-20 17:01 ` redi at gcc dot gnu.org
@ 2012-01-04 20:45 ` petschy at gmail dot com
  2012-01-04 22:21 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: petschy at gmail dot com @ 2012-01-04 20:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640

--- Comment #2 from petschy at gmail dot com 2012-01-04 20:45:00 UTC ---
I pinpointed the commit that introduced the bug, using git bisect:

commit 4272a2e82e431ac85afd0404d49b28043dc480ee
Author: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Nov 27 10:44:49 2009 +0000

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154698
138bc75d-0d04-0410-961f-82ee72b054a4


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
                   ` (2 preceding siblings ...)
  2012-01-04 20:45 ` petschy at gmail dot com
@ 2012-01-04 22:21 ` pinskia at gcc dot gnu.org
  2014-05-16 15:02 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-04 22:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51640

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |35112

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-04 22:21:07 UTC ---
(In reply to comment #2)
> I pinpointed the commit that introduced the bug, using git bisect:
> 
> commit 4272a2e82e431ac85afd0404d49b28043dc480ee
> Author: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
> Date:   Fri Nov 27 10:44:49 2009 +0000
> 
> git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154698
> 138bc75d-0d04-0410-961f-82ee72b054a4

http://gcc.gnu.org/viewcvs?view=revision&revision=154698


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
                   ` (3 preceding siblings ...)
  2012-01-04 22:21 ` pinskia at gcc dot gnu.org
@ 2014-05-16 15:02 ` paolo.carlini at oracle dot com
  2014-05-16 17:43 ` paolo.carlini at oracle dot com
  2014-05-16 17:43 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-16 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|paolo at gcc dot gnu.org           |
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm noticing this only today, sorry about that.

Luckily, anyway, it's fixed and doesn't affect 4.9.0 and mainline. However, we
can avoid a redundant error message, I'm tweaking that for 4.10.


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
                   ` (4 preceding siblings ...)
  2014-05-16 15:02 ` paolo.carlini at oracle dot com
@ 2014-05-16 17:43 ` paolo.carlini at oracle dot com
  2014-05-16 17:43 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-05-16 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


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

* [Bug c++/51640] Misleading error if the type in the catch() is ambiguous
  2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
                   ` (5 preceding siblings ...)
  2014-05-16 17:43 ` paolo.carlini at oracle dot com
@ 2014-05-16 17:43 ` paolo at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-05-16 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri May 16 17:42:23 2014
New Revision: 210521

URL: http://gcc.gnu.org/viewcvs?rev=210521&root=gcc&view=rev
Log:
/cp
2014-05-16  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51640
    * parser.c (cp_parser_diagnose_invalid_type_name): Early return
    when cp_parser_lookup_name sets ambiguous_decls.

/testsuite
2014-05-16  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51640
    * g++.dg/parse/error54.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/parse/error54.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-05-16 17:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-20 16:49 [Bug c++/51640] New: Misleading error if the type in the catch() is ambiguous petschy at gmail dot com
2011-12-20 16:49 ` [Bug c++/51640] " petschy at gmail dot com
2011-12-20 17:01 ` redi at gcc dot gnu.org
2012-01-04 20:45 ` petschy at gmail dot com
2012-01-04 22:21 ` pinskia at gcc dot gnu.org
2014-05-16 15:02 ` paolo.carlini at oracle dot com
2014-05-16 17:43 ` paolo.carlini at oracle dot com
2014-05-16 17:43 ` paolo 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).