This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/10381: [3.4 regression] Accepts call to inexistent function


>Number:         10381
>Category:       c++
>Synopsis:       [3.4 regression] Accepts call to inexistent function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 11 19:46:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:
mainline (3.4)
>Description:
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.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]