public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9990: locale_facets.h contains invalid typedef
@ 2003-03-21 14:28 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2003-03-21 14:28 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nasgaard, nathan, nobody

Synopsis: locale_facets.h contains invalid typedef

Responsible-Changed-From-To: nathan->unassigned
Responsible-Changed-By: nathan
Responsible-Changed-When: Fri Mar 21 14:28:53 2003
Responsible-Changed-Why:
    not working on it - Mark & I agree this is a change request,
    as the code is ill formed, but no diagnostic is required

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9990


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9990: locale_facets.h contains invalid typedef
@ 2003-03-09 15:56 Nathan Sidwell
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2003-03-09 15:56 UTC (permalink / raw)
  To: nathan; +Cc: gcc-prs

The following reply was made to PR c++/9990; it has been noted by GNATS.

From: Nathan Sidwell <nathan.sidwell@blueyonder.co.uk>
To: paolo@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   nasgaard@ca.ibm.com, nathan@gcc.gnu.org, nobody@gcc.gnu.org,
   gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9990: locale_facets.h contains invalid typedef
Date: Sun, 09 Mar 2003 15:53:28 +0000

 I can't tell if this is well formed or not.
 
 typename ctype::mask is looked up at instantiation time. Now does it find the
 typedef in ctype, or does it find the typedef in ctype_base? If this were
 not a template class, it would find the latter, ctype::mask not being in scope
 at the point of parsing the decl-spec.
 
 I believe class template instantiation should behave as closely as possible
 to the non-template equivalent. In which case the typename will find
 the name in the base class, and then insert the typedef into the instantiated
 class's scope. The standard doesn't specify precisely how instantiation
 happens. There are (sort of) two choices
 1) build up the instantiated class and its members much like a non-template
 class definition is constructed. I.e. what I've described above
 2) bind all the names declared, to types, functions, fields or whatever,
 then instantiate each of those declared things.
 
 IIRC gcc kind of does a mixture of the two :(
 
 Anyway, even if we do 1, do we fall foul of [3.3.6]/2? I think we do.
 note no diagnostic is required for such a violation. We also fail to issue one
 for the non-template case of N being a qualified id. Such as,
 	struct B { typedef int X;};
 	struct C : B { typedef C::X Y;
 	int X;
 	};
 
 I think this is really a 'request for change'
 
 nathan
 
 -- 
 Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
           The voices in my head said this was stupid too
 nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
 
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: c++/9990: locale_facets.h contains invalid typedef
@ 2003-03-09 11:54 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2003-03-09 11:54 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nasgaard, nathan, nobody

Synopsis: locale_facets.h contains invalid typedef

Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Mar  9 11:54:40 2003
Responsible-Changed-Why:
    Nathan, this is really a C++ issue, could you please
    have a look? Thanks in advance, Paolo.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Mar  9 11:54:40 2003
State-Changed-Why:
    Actually, EDG-based compilers in strict mode also compile it.
    Matter for a language lawyer.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9990


^ permalink raw reply	[flat|nested] 4+ messages in thread

* c++/9990: locale_facets.h contains invalid typedef
@ 2003-03-07 17:26 nasgaard
  0 siblings, 0 replies; 4+ messages in thread
From: nasgaard @ 2003-03-07 17:26 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-21 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 14:28 c++/9990: locale_facets.h contains invalid typedef nathan
  -- strict thread matches above, loose matches on Subject: below --
2003-03-09 15:56 Nathan Sidwell
2003-03-09 11:54 paolo
2003-03-07 17:26 nasgaard

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).