Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
HP aCC 3.26 through 3.73
-
Compiler Error
Description
Moved from Rogue Wave bug tracking database:
***Created By: sebor @ Dec 28, 2000 07:27:54 PM***
Subject: aCC 3.26 can't reference a member template operator
Date: Thu, 28 Dec 2000 19:27:36 -0700
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: HP aCC mailing list <acxx-beta@cup.hp.com>
Hi,
this is also failing to compile (in case Perennial doesn't expose it).
Regards
Martin
$ cat t.cpp
template <class T>
struct B { };
template<class T>
struct A
{
template <class U>
operator B<U>();
};
void foo ()
{
A<int>().operator B<char>();
}
$ aCC -V -c t.cpp
aCC: HP ANSI C++ B3910B A.03.26
Error 187: "t.cpp", line 15 # Referenced object 'operator B<char>' is not a
member of struct A<int> ["t.cpp", line 5].
A<int>().operator B<char>();
^^^^^^^^^^^^^^^^
***Modified By: sebor @ Dec 29, 2000 11:55:23 AM***
Subject: Re: aCC 3.26 can't reference a member template operator
Date: Thu, 28 Dec 2000 21:53:11 -0800 (PST)
From: Dennis Handly <dhandly@cup.hp.com>
To: sebor@roguewave.com
CC: acxx-beta@cup.hp.com
>This is also failing to compile (in case Perennial doesn't expose it).
Martin
This looks like the error in P26137.C.
CR JAGad01438
P51 P26137.C Error 187 on use of member template conversion operator
I'll add your test in case the extra B<U> is different than just operator U.
***Modified By: sebor @ Dec 29, 2000 04:40:33 PM***
Subject: Re: aCC 3.26 can't reference a member template operator
Date: Fri, 29 Dec 2000 16:40:17 -0700
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: Dennis Handly <dhandly@cup.hp.com>
CC: acxx-beta@cup.hp.com
References: 1
Dennis Handly wrote:
...
> I'll add your test in case the extra B<U> is different than just operator U.
Here's another testcase. This one gives a different error. In case you're
wondering, these are showing up as I'm trying to fix (amd test) our auto_ptr.
Martin
$ cat t.cpp
template <class>
struct B;
template <class T>
struct A
{
template <class U>
A (const B<U>&);
};
template <class T>
struct B
{
B ();
B (const A<T>&);
template <class U>
operator A<U>();
};
int main ()
{
B<void> b;
A<int> a = A<int>(b);
}
$ aCC -AA -V -c t.cpp
aCC: HP ANSI C++ B3910B A.03.26
Error 225: "t.cpp", line 24 # Ambiguous overloaded function call; more than
one acceptable function found. Two such functions that matched were
"B<void>::operator A<int><int>()" ["t.cpp", line 18] and
"A<int>::A<void>(const B<void> &)" ["t.cpp", line 8].
A<int> a = A<int>(b);
^
***Modified By: sebor @ Jan 04, 2001 11:43:42 AM***
Subject: Re: aCC 3.26 can't reference a member template operator
Date: Thu, 4 Jan 2001 02:25:20 -0800 (PST)
From: Dennis Handly <dhandly@cup.hp.com>
To: dhandly@cup.hp.com, sebor@roguewave.com
CC: acxx-beta@cup.hp.com
>Here's another testcase. This one gives a different error. In case you're
>wondering, these are showing up as I'm trying to fix (and test) our auto_ptr.
Martin
At one time there was a discussion about this error with auto_ptr but
I don't think we filed any bugs. The problem seemed to be related on
what was a "viable" cantidate.
Error 225: line 24 # Ambiguous overloaded function call; more than
one acceptable function found. Two such functions that matched were
"B<void>::operator A<int><int>()" [line 18] and
"A<int>::A<void>(const B<void> &)" [line 8].
A<int> a = A<int>(b);
^
Here it looks like you don't want the user defined conversion?
Or are both of them user defined?
I assume you know you can change:
A<int> a = A<int>(b);
to:
A<int> a(b);
to get that to work?
But if you really wanted to to:
(A<int>)b;
You get the same errors.
I filed the following bug report for you:
CR JAGad44417
Error 225 overloading on member functions, ctor vs conversion operator
***Modified By: sebor @ Jan 28, 2003 12:16:02 PM***
Still fails with 3.39.
Attachments
Issue Links
- blocks
-
STDCXX-616 [HP aCC 3.73] compilation errors in 20.auto.ptr.cpp
- Closed