const int null = 0;

Marc A. Lepage mlepage@molecularmining.com
Mon Apr 17 12:28:00 GMT 2000


kafka$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
kafka$ uname -a
Linux kafka 2.2.5 #1 SMP Mon Apr 12 02:29:46 EDT 1999 i686 unknown
kafka$ g++ null.cpp 
null.cpp: In method `void Foo::g()':
null.cpp:27: no matching function for call to `Foo::f (const int &)'
null.cpp:21: candidates are: void Foo::f(int *)
null.cpp: In function `int main(int, char *)':
null.cpp:37: no matching function for call to `Foo::f (const int &)'
null.cpp:21: candidates are: void Foo::f(int *)

-- 
Marc A. Lepage
Software Developer
Molecular Mining Corporation
http://www.molecularmining.com/
const int null = 0;

void f(int* pn)
{
}

void g()
{
    f(0);
    f(null); // okay
}

class Foo
{
public:
    void f(int* pn);
    void g();
};

void Foo::f(int* pn)
{
}

void Foo::g()
{
    f(0);
    f(null); // compile error
}

int main(int argc, char* argv)
{
    f(0);
    f(null); // okay

    Foo foo;
    foo.f(0);
    foo.f(null); // compile error
}


More information about the Gcc-bugs mailing list