This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/1874: Internal error created trying to cast - possibly incrorrectly - using trait-type classes and explicit 'class' keyword
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/1874: Internal error created trying to cast - possibly incrorrectly - using trait-type classes and explicit 'class' keyword
- From: tony at mpi-softtech dot com
- Date: 5 Feb 2001 06:23:44 -0000
- Reply-To: tony at mpi-softtech dot com
>Number: 1874
>Category: c++
>Synopsis: Internal error created trying to cast - possibly incrorrectly - using trait-type classes and explicit 'class' keyword
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 04 22:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Anthony Skjellum
>Release: GNU G++ 2.95.2
>Organization:
>Environment:
Sun Sparc4
>Description:
A possible syntax error, but possibly legal declaration
inside a cast causes an internal compiler error, and
request for full bug report (hence provided).
This line of inquiry was started because of issues with
use of typename for trait classes, and where 'typename'
or 'class' should or must appear to be able to have
class members behave as types correctly. Since GNU
C++ treats specializations of the form
template<>
name-of-function(args)
{
}
as non-template functions, and hence disallows 'typename' in them, one has to relocate typename to other parts of
the program code. Apparently, other compilers allow
empty template functions still to be treated as templated,
so that specializations of this form can support existence
of typename in them, and hence traits can be defined with
typename usage, where needed/desired. This original
line of inquiry is actually more interesting than the bug
discovered, and we are studying the C++ standard further
on the point of such specializations, and where typename/class must be used with trait-type class members.
>How-To-Repeat:
Line 108 of the source file, shows the cast and the
problem it causes.
>Fix:
avoid the use of 'class' in the cast shown.
The purpose of attempting to use the 'class' keyword
is in the first place to see if/when it is required
to explicitly type traits.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="output-of-compilation"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="output-of-compilation"