This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/1985: bare typename inside of template function fails



>Number:         1985
>Category:       c++
>Synopsis:       bare typename inside of template function fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 14 14:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     hudson@swcp.com
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
TurboLinux 6.0 i386
>Description:
template.cpp: In function `void foo(const L &)':
template.cpp:4: Internal compiler error.
template.cpp:4: Please submit a full bug report.
>How-To-Repeat:
template< class L >
void foo( const L &l )
{
        typename L::const_iterator;
        L::const_iterator i = l.begin();
}


>Fix:
Do not use bare typename:

template< class L >
void foo( const L &l )
{
        typedef typename L::const_iterator const_iterator;
        const_iterator i = l.begin();
}

Unfortunately the macros that generated the original code need
to use the syntax L::const_iterator in order to work.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="template.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="template.cpp"

dGVtcGxhdGU8IGNsYXNzIEwgPgp2b2lkIGZvbyggY29uc3QgTCAmbCApCnsKCXR5cGVkZWYgdHlw
ZW5hbWUgTDo6Y29uc3RfaXRlcmF0b3IgY29uc3RfaXRlcmF0b3I7Cgljb25zdF9pdGVyYXRvciBp
ID0gbC5iZWdpbigpOwp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]