public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: nasgaard@ca.ibm.com
To: gcc-gnats@gcc.gnu.org
Subject: c++/9990: locale_facets.h contains invalid typedef
Date: Fri, 07 Mar 2003 17:26:00 -0000	[thread overview]
Message-ID: <20030307171728.25855.qmail@sources.redhat.com> (raw)


>Number:         9990
>Category:       c++
>Synopsis:       locale_facets.h contains invalid typedef
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 07 17:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Howard Nasgaard
>Release:        unknown-1.0
>Organization:
>Environment:
This problem has been observed on both Mac OSX and Linux PPC systems.
>Description:
The problem here is on or about line 178 in locale_facets.h.

typedef typename ctype::mask      mask;

This typedef is illegal based on the latest C++ standard and, while g++ compiles with no problem, the IBM C++ compiler flags this as an error. The following is a reduced version of the same construct.

class ctype_base
{
public:

    typedef unsigned short mask;
};

template <class _CharT>
class __ctype_abstract_base : public ctype_base
{
public:
};

template <class _CharT>
class ctype : public __ctype_abstract_base<_CharT>
{
public:
   typedef typename ctype::mask      mask;
};

int main()
{
   ctype<char> cc;
   return 0;
}

This should be flagged as an error but it's not.  I expect the correct line should be:
typedef typename __ctype_abstract_base<_CharT>::mask mask;

The applicable part of the standard is:
"In the definition of a class template or a member of a class template, if a base class of the class template depends on a template-parameter, the base class scope is not examined during unqualified name lookup either at the point of definition of the class template or member or during an instantiation of the class template or member."
>How-To-Repeat:
gcc a.C
And it SHOULD fail, but doesn't.

Here's the output from a compile:
Reading specs from /usr/lib/gcc-lib/powerpc-suse-linux/3.2/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit powerpc-suse-linux
Thread model: posix
gcc version 3.2
 /usr/lib/gcc-lib/powerpc-suse-linux/3.2/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -DPPC -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC -D__powerpc -Acpu=powerpc -Amachine=powerpc -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -D_CALL_SYSV -D_BIG_ENDIAN -D__BIG_ENDIAN__ -Amachine=bigendian -D_ARCH_PPC -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=unix -Asystem=posix a.C -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -quiet -dumpbase a.C -version -o /home/nasgaard/tmp/cccA3faS.s
GNU CPP version 3.2 (cpplib) (PowerPC GNU/Linux)
GNU C++ version 3.2 (powerpc-suse-linux)
        compiled by GNU C version 3.2.
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/powerpc-suse-linux
 /usr/include/g++/backward
 /usr/local/include
 /usr/lib/gcc-lib/powerpc-suse-linux/3.2/include
 /usr/powerpc-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/powerpc-suse-linux/3.2/../../../../powerpc-suse-linux/bin/as -mppc -V -Qy -o a.o /home/nasgaard/tmp/cccA3faS.s
GNU assembler version 2.12.90.0.15 (powerpc-suse-linux) using BFD version 2.12.90.0.15 20020717 (SuSE)
>Fix:
I believe the fix should be:
typedef typename __ctype_abstract_base<_CharT>::mask mask;
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2003-03-07 17:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-07 17:26 nasgaard [this message]
2003-03-09 11:54 paolo
2003-03-09 15:56 Nathan Sidwell
2003-03-21 14:28 nathan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030307171728.25855.qmail@sources.redhat.com \
    --to=nasgaard@ca.ibm.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).