compile or not compile

Karol Szkudlarek karol@mikronika.com.pl
Thu Jul 1 20:48:00 GMT 2004


Eljay Love-Jensen wrote:

> Hi Karo,
>
> Add this to your class A:
>
> int foo(Items const&)
> {
>   std::cerr << "A::Items\n";
>   return 0;
> }
>
> HTH,
> --Eljay
>
Hi!

I can't use you solution in my code because in real example I have 
little different sitiuation.
In my second test case I try to explain more precisely my real case. 
Look at the following code:

// SECOND_CASE
typedef int my_int;

class ALibraryClass
{

public:
    int foo(const my_int&)
        {
            return 0;
        }
    int foo(const bool&)
        {
            return 0;
        }
};

class BClientClass
{
    public:
    enum Items
    {
        item1=1000,
        item2=2000
    };
    void test()
    {
        ALibraryClass a;
        a.foo(BClientClass::item1);
    }
};

int main()
{
    BClientClass b;
    b.test();
    return 0;
}

In class ALibraryClass I can't define int foo(Items const&)
because I know nothing about enum Items from client class BClientClass.


Generally I would like to know why this program compiles fine (gcc 3.3.3)
under Debian but does not compile under Suse (gcc 3.3.3).  Is it possible
such a difference in compiling results with the same versions of compiler?
Is that different situation can suggest compiler bug or for example 
different
default settings/options of same compiler?

Greets,Karol Szk



More information about the Gcc-help mailing list