This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/548: Instantiation of template function as type parameter fails
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/548: Instantiation of template function as type parameter fails
- From: markusk at pvv dot org
- Date: 19 Sep 2000 09:46:50 -0000
- Reply-To: markusk at pvv dot org
- Resent-Cc: gcc-prs at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, jason at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, markusk@pvv.org
>Number: 548
>Category: c++
>Synopsis: Instantiation of template function as type parameter fails
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Sep 19 02:56:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Markus Bjartveit Krüger
>Release: egcs-2.91.66
>Organization:
>Environment:
RedHat 6.2, i686
>Description:
When compiling a C++ program containing a template function
with a template function as a type parameter, g++ fails
with the following error message:
$ g++ stllist.C -o stllist
stllist.C: In function `int main()':
stllist.C:14: Internal compiler error 980715.
stllist.C:14: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
stllist.C:14: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for details.
The line triggering the error is as follows:
for_each(intlist.begin(), intlist.end(), printer<int>);
>How-To-Repeat:
Compile attached file.
>Fix:
As a workaround, insert an ampersand before the template
function:
...
for_each(intlist.begin(), intlist.end(), &printer<int>);
...
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="stllist.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="stllist.C"
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxpb3N0cmVhbT4K
CnRlbXBsYXRlIDxjbGFzcyBDPiB2b2lkIHByaW50ZXIoQyBkYXRhKQp7CiAgY291dCA8PCBkYXRh
IDw8IGVuZGw7Cn0KCmludAptYWluKCkKewogIGxpc3Q8aW50PiBpbnRsaXN0OwogIGZvcl9lYWNo
KGludGxpc3QuYmVnaW4oKSwgaW50bGlzdC5lbmQoKSwgcHJpbnRlcjxpbnQ+KTsKfQo=