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)
Fix: http://gcc.gnu.org/ml/gcc-patches/2003-04/msg01168.html
State-Changed-From-To: open->analyzed State-Changed-Why: Confirmed by existence of 10372. See also PR 10371.
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
State-Changed-From-To: analyzed->closed State-Changed-Why: Fixed in GCC 3.4.