🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #910

argument matching depending on the def order

#910
From: kondo
Date: Fri, 04 Sep 1992 08:41
35 lines
1141 bytes
I'm not sure this is reported before or not, but here it goes. 
The following program compiled with g++-2.2.2 produces

A(int*)
B(double*)

I believe this is not a feature of C++.

Ryou Kondo (kondo@mech.ibaraki.ac.jp)
Dept of Mech Eng
Ibaraki Univ
--------------------------------------------------
#include <iostream.h>
//  check the order of declarations
class A {
public:
    void f(double* p) { cout << "A(double*)\n"; }
    void f(int* p) { cout << "A(int*)\n"; }
};

class B {
public:
    void f(int* p) { cout << "B(int*)\n"; }
    void f(double* p) { cout << "B(double*)\n"; }
};

main()
{
    A a;
    B b;

    a.f(0); 
    b.f(0);
}
--------------------------------------------------
Technical Details
Message-ID: <9209040841.AA00851@akane.mech.ibaraki.ac.jp>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!akane.mech.ibaraki.ac.JP!kondo

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!akane.mech.ibaraki.ac.JP!kondo
From: kondo@akane.mech.ibaraki.ac.JP
Subject: argument matching depending on the def order
Message-ID: <9209040841.AA00851@akane.mech.ibaraki.ac.jp>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 4 Sep 1992 08:41:05 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 36