Bug 10381 - [3.4 regression] Accepts call to inexistent function
Summary: [3.4 regression] Accepts call to inexistent function
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P3 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
: 9120 10372 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-11 19:46 UTC by Wolfgang Bangerth
Modified: 2004-07-13 17:42 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2003-04-11 19:46:00 UTC
This is actually almost unbelievable: present 3.4 accepts
this code:
-----------------------------
struct X {};

template <int>
struct Base {
    static void foo () {
      X::NONEXISTENT ();
    }
};

int main () {
  Base<2>::foo ();
}
-----------------------------
Note the call to the nonexistent member function of X. What
is worse: it doesn't even generate a linker error, it just
ignores the call in the front end. I stumbled upon this
because I mistyped the name of a function, and was wondering
why the call to it had no effect -- very, very deceiving.
The program can be linked and run, by the way, but doesn't
do anything useful.

Mark, I CC: you because this might be cause by the two-stage
name lookup, but I'm in no way sure whether that's the case.
I would really love to see this being fixed quickly, since
it's so mean and can take you a long time to find...

W.

Release:
unknown

Environment:
mainline (3.4)
Comment 1 Wolfgang Bangerth 2003-04-11 19:46:00 UTC
Fix:
http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01168.html
Comment 2 Wolfgang Bangerth 2003-04-11 23:05:48 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed by existence of 10372. See also PR 10371.
Comment 3 Mark Mitchell 2003-04-15 20:23:36 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10381
Date: 15 Apr 2003 20:23:36 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-15 20:23:36
 
 Modified files:
 	gcc/cp         : ChangeLog parser.c 
 	gcc/testsuite  : ChangeLog 
 	gcc/testsuite/lib: prune.exp 
 Added files:
 	gcc/testsuite/g++.dg/parse: lookup3.C 
 
 Log message:
 	PR c++/10381
 	* parser.c (cp_parser_primary_expression): Reorganize logic for
 	dealing with name lookup failures.
 	
 	PR c++/10381
 	* g++.dg/parse/lookup3.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3326&r2=1.3327
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.55&r2=1.56
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2596&r2=1.2597
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/lookup3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/lib/prune.exp.diff?cvsroot=gcc&r1=1.9&r2=1.10
 

Comment 4 Mark Mitchell 2003-04-15 20:23:36 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/10381
Date: 15 Apr 2003 20:23:36 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-04-15 20:23:36
 
 Modified files:
 	gcc/cp         : ChangeLog parser.c 
 	gcc/testsuite  : ChangeLog 
 	gcc/testsuite/lib: prune.exp 
 Added files:
 	gcc/testsuite/g++.dg/parse: lookup3.C 
 
 Log message:
 	PR c++/10381
 	* parser.c (cp_parser_primary_expression): Reorganize logic for
 	dealing with name lookup failures.
 	
 	PR c++/10381
 	* g++.dg/parse/lookup3.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3326&r2=1.3327
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.55&r2=1.56
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2596&r2=1.2597
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/lookup3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/lib/prune.exp.diff?cvsroot=gcc&r1=1.9&r2=1.10
Comment 5 Mark Mitchell 2003-04-15 20:25:40 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in GCC 3.4.