public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* errors in porting on gcc 3.4.6 from gcc 3.2.3
@ 2007-05-15 10:47 kushwaha
  2007-05-15 11:14 ` Lionel B
  0 siblings, 1 reply; 4+ messages in thread
From: kushwaha @ 2007-05-15 10:47 UTC (permalink / raw)
  To: gcc-help


hi all..

Following is the part of a code giving error with gcc 3.4.6  which
previously compiled with gcc 3.2.3. As i am porting the software so can't
change the code. is there any way to get it compiled without modifying
actual code??


//BpHashMap.h

template <class TKey, class TValue>
class BpHashMap {

  public :

    TValue getValue(TValue val);
    TKey getKey(TKey key);
};


class HString_Key {

    const char* mpcId;
    unsigned long mulId;

  public :

    HString_Key() : mpcId(" "), mulId(0) { }
    HString_Key(const char* apcId, unsigned long aulId) : mpcId(apcId),
mulId(aulId) { }

};


template <class T>
class Equal_to_HString_Key {

    HString_Key  key;

  public :

    Equal_to_HString_Key(const char* apcCallId, unsigned long apcHashId) {
      key.mpcCallId = apcCallId;
      key.mulHashId = apcHashId;
    }

    void Id();
};


//BpHashMap.C

#include "BpHashMap.h"
#include <iostream>

using namespace std;

template <class TKey, class TValue>
TValue
BpHashMap<TKey, TValue>::getValue(TValue val) {
    TValue t = val;

    return t;
}

template <class TKey, class TValue>
TKey
BpHashMap<TKey, TValue>::getKey(TKey key) {
    TKey t = key;

    return t;
}

// just to find the result of compilation
int main()
{
    BpHashMap<char, int> obj1;

    cout<<obj1.getValue(25);
    cout<<endl;
    cout<<obj1.getKey('a');
    cout<<endl;

    return 0;
}

-- 
View this message in context: http://www.nabble.com/errors-in-porting-on-gcc-3.4.6-from-gcc-3.2.3-tf3757763.html#a10620590
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors in porting on gcc 3.4.6 from gcc 3.2.3
  2007-05-15 10:47 errors in porting on gcc 3.4.6 from gcc 3.2.3 kushwaha
@ 2007-05-15 11:14 ` Lionel B
  2007-05-15 11:49   ` kushwaha
  0 siblings, 1 reply; 4+ messages in thread
From: Lionel B @ 2007-05-15 11:14 UTC (permalink / raw)
  To: gcc-help

On Tue, 15 May 2007 03:47:03 -0700, kushwaha wrote:

> hi all..
> 
> Following is the part of a code giving error with gcc 3.4.6  which
> previously compiled with gcc 3.2.3.

Are you sure...? Compiling your code (gcc 4.1.2) I get:

error: ‘class HString_Key’ has no member named ‘mpcCallId’
error: ‘class HString_Key’ has no member named ‘mulHashId’

from these lines:

    key.mpcCallId = apcCallId;
    key.mulHashId = apcHashId;

and sure enough, your class template HString_Key does not contain those 
members. I don't see how this could have compiled with gcc 3.2.3. Didn't 
you mean:

    key.mpcId = apcCallId;
    key.mulId = apcHashId;

in Equal_to_HString_Key::Equal_to_HString_Key(...) ? Compiles ok for me 
with this change.

[...]

-- 
Lionel B

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors in porting on gcc 3.4.6 from gcc 3.2.3
  2007-05-15 11:14 ` Lionel B
@ 2007-05-15 11:49   ` kushwaha
  2007-05-15 12:19     ` Lionel B
  0 siblings, 1 reply; 4+ messages in thread
From: kushwaha @ 2007-05-15 11:49 UTC (permalink / raw)
  To: gcc-help


yes.. the code is correct and getting compiled on gcc 3.2.3. i just want to
know is there is any option to avoid that strict checking on gcc 3.4.6 as i
can't change the code.




Lionel B wrote:
> 
> On Tue, 15 May 2007 03:47:03 -0700, kushwaha wrote:
> 
>> hi all..
>> 
>> Following is the part of a code giving error with gcc 3.4.6  which
>> previously compiled with gcc 3.2.3.
> 
> Are you sure...? Compiling your code (gcc 4.1.2) I get:
> 
> error: ‘class HString_Key’ has no member named ‘mpcCallId’
> error: ‘class HString_Key’ has no member named ‘mulHashId’
> 
> from these lines:
> 
>     key.mpcCallId = apcCallId;
>     key.mulHashId = apcHashId;
> 
> and sure enough, your class template HString_Key does not contain those 
> members. I don't see how this could have compiled with gcc 3.2.3. Didn't 
> you mean:
> 
>     key.mpcId = apcCallId;
>     key.mulId = apcHashId;
> 
> in Equal_to_HString_Key::Equal_to_HString_Key(...) ? Compiles ok for me 
> with this change.
> 
> [...]
> 
> -- 
> Lionel B
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/errors-in-porting-on-gcc-3.4.6-from-gcc-3.2.3-tf3757763.html#a10621291
Sent from the gcc - Help mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: errors in porting on gcc 3.4.6 from gcc 3.2.3
  2007-05-15 11:49   ` kushwaha
@ 2007-05-15 12:19     ` Lionel B
  0 siblings, 0 replies; 4+ messages in thread
From: Lionel B @ 2007-05-15 12:19 UTC (permalink / raw)
  To: gcc-help

On Tue, 15 May 2007 04:49:02 -0700, kushwaha wrote:

> Lionel B wrote:
>> 
>> On Tue, 15 May 2007 03:47:03 -0700, kushwaha wrote:
>> 
>>> hi all..
>>> 
>>> Following is the part of a code giving error with gcc 3.4.6  which
>>> previously compiled with gcc 3.2.3.
>> 
>> Are you sure...? Compiling your code (gcc 4.1.2) I get:
>> 
>> error: ‘class HString_Key’ has no member named ‘mpcCallId’ error:
>> ‘class HString_Key’ has no member named ‘mulHashId’
>> 
>> from these lines:
>> 
>>     key.mpcCallId = apcCallId;
>>     key.mulHashId = apcHashId;
>> 
>> and sure enough, your class template HString_Key does not contain those
>> members. I don't see how this could have compiled with gcc 3.2.3.
>> Didn't you mean:
>> 
>>     key.mpcId = apcCallId;
>>     key.mulId = apcHashId;
>> 
>> in Equal_to_HString_Key::Equal_to_HString_Key(...) ? Compiles ok for me
>> with this change.
>> 
>> [...]
>> 
>> --
>> Lionel B
   ^^^^^^^^
Please don't quote sigs.

Please don't top-post (rearranged)

> yes.. the code is correct

... for some slightly strange value of "correct" ;)

> and getting compiled on gcc 3.2.3. i just want
> to know is there is any option to avoid that strict checking on gcc
> 3.4.6 as i can't change the code.

Well, the offending template doesn't actually appear to be used in the 
code, so I guess gcc 3.2.3 just ignored it; I've had a brief look if 
there are any flags for gcc that might suppress checking of templates 
that are never instantiated, but couldn't find anything that works. Sorry,

-- 
Lionel B

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-05-15 12:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-15 10:47 errors in porting on gcc 3.4.6 from gcc 3.2.3 kushwaha
2007-05-15 11:14 ` Lionel B
2007-05-15 11:49   ` kushwaha
2007-05-15 12:19     ` Lionel B

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).