public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages
@ 2004-08-10 14:31 bangerth at dealii dot org
  2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-08-10 14:31 UTC (permalink / raw)
  To: gcc-bugs

Consider this little example, derived from PR 16963: 
------------- 
template <typename T> struct B { 
    static int Bar(T); 
}; 
struct D : B<int>, B<char> {}; 
 
int i1 = D().Bar(1); 
int i2 = D::Bar(2); 
------------- 
Note that Bar() is static, so trying to call it via D().Bar or D::Bar 
shouldn't make a difference (for a moment ignore the fact that the 
code doesn't compile at all, probably for a good reason, as discussed 
in PR 16963). However, we get this confusing mismatch in error messages: 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc:6: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
x.cc:7: error: `Bar' is not a member of `D' 
 
The error message in line 7 is clearly not helpful, and wrong above 
that. It should simply read the same as the ambiguity message in line 6. 
This is a regression in 3.4 and mainline over previous versions that 
simply printed as expected: 
 
g/x> /home/bangerth/bin/gcc-3.3*/bin/c++ -c x.cc 
x.cc:6: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
x.cc:7: error: request for member `Bar' is ambiguous 
x.cc:2: error: candidates are: static int B<T>::Bar(T) [with T = char] 
x.cc:2: error:                 static int B<T>::Bar(T) [with T = int] 
 
W.

-- 
           Summary: [3.4/3.5 regression] Confusing mismatch in error
                    messages
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/16965] [3.4/3.5 regression] Confusing mismatch in error messages
  2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
@ 2004-08-10 14:31 ` bangerth at dealii dot org
  2004-08-15  5:51 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-08-10 14:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.1 3.5.0
      Known to work|                            |2.95 3.2 3.3
   Target Milestone|---                         |3.4.2


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


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

* [Bug c++/16965] [3.4/3.5 regression] Confusing mismatch in error messages
  2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
  2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
@ 2004-08-15  5:51 ` pinskia at gcc dot gnu dot org
  2004-08-17  7:24 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-15  5:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-15 05:51 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-15 05:51:30
               date|                            |


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


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

* [Bug c++/16965] [3.4/3.5 regression] Confusing mismatch in error messages
  2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
  2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
  2004-08-15  5:51 ` pinskia at gcc dot gnu dot org
@ 2004-08-17  7:24 ` mmitchel at gcc dot gnu dot org
  2004-08-17 17:32 ` cvs-commit at gcc dot gnu dot org
  2004-08-17 17:37 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-17  7:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-17 07:24 -------
This is not worth fixing for GCC 3.4.x.  Retargeted at GCC 3.5.  I am working on
a fix.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Target Milestone|3.4.2                       |3.5.0


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


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

* [Bug c++/16965] [3.4/3.5 regression] Confusing mismatch in error messages
  2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2004-08-17  7:24 ` mmitchel at gcc dot gnu dot org
@ 2004-08-17 17:32 ` cvs-commit at gcc dot gnu dot org
  2004-08-17 17:37 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-17 17:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-08-17 17:32 -------
Subject: Bug 16965

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-08-17 17:32:37

Modified files:
	gcc/cp         : ChangeLog cp-tree.h name-lookup.c parser.c pt.c 
	                 semantics.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/parse: error17.C 

Log message:
	PR c++/16965
	* cp-tree.h (qualified_name_lookup_error): Add parameter.
	* name-lookup.c (do_class_using_decl): Restrict set of entities
	passed to cp_emit_debug_info_for_using more carefully.
	(lookup_qualified_name): Allow lookup_member to return sets of
	ambiguous entries.
	* parser.c (cp_parser_lookup_name): Add ambiguous_p parameter.
	(cp_parser_primary_expression): Handle ambiguous lookups.
	(cp_parser_template_name): Adjust use of cp_parser_lookup_name.
	(cp_parser_template_argument): Likewise.
	(cp_parser_elaborate_type_specifier): Likewise.
	(cp_parser_namespace_name): Likewise.
	(cp_parser_class_name): Likewise.
	(cp_parser_lookup_name_simple): Likewise.
	* pt.c (tsubst_qualified_id): Handle ambiguous results.
	(tsubst_expr): Likewise.
	* semantics.c (qualified_name_lookup_error): Add decl paramter.
	For ambiguous lookups, print candidates.
	
	PR c++/16965
	* g++.dg/parse/error17.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4277&r2=1.4278
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1030&r2=1.1031
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.81&r2=1.82
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.236&r2=1.237
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.905&r2=1.906
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/semantics.c.diff?cvsroot=gcc&r1=1.423&r2=1.424
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4149&r2=1.4150
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/error17.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug c++/16965] [3.4/3.5 regression] Confusing mismatch in error messages
  2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2004-08-17 17:32 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-17 17:37 ` mmitchel at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-08-17 17:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-08-17 17:37 -------
Fixed in GCC 3.5.0.

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


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


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

end of thread, other threads:[~2004-08-17 17:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-10 14:31 [Bug c++/16965] New: [3.4/3.5 regression] Confusing mismatch in error messages bangerth at dealii dot org
2004-08-10 14:31 ` [Bug c++/16965] " bangerth at dealii dot org
2004-08-15  5:51 ` pinskia at gcc dot gnu dot org
2004-08-17  7:24 ` mmitchel at gcc dot gnu dot org
2004-08-17 17:32 ` cvs-commit at gcc dot gnu dot org
2004-08-17 17:37 ` mmitchel at gcc dot gnu dot 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).