public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/4477: sizeof on nested class members doesn't compile
@ 2001-10-22  9:40 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2001-10-22  9:40 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, roman.kagan

Synopsis: sizeof on nested class members doesn't compile

State-Changed-From-To: open->analyzed
State-Changed-By: lerdsuwa
State-Changed-When: Mon Oct 22 09:40:30 2001
State-Changed-Why:
    Confirm as a bug.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4477&database=gcc


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

* c++/4477: sizeof on nested class members doesn't compile
@ 2001-10-05  3:56 roman.kagan
  0 siblings, 0 replies; 2+ messages in thread
From: roman.kagan @ 2001-10-05  3:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         4477
>Category:       c++
>Synopsis:       sizeof on nested class members doesn't compile
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 05 03:56:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.1
>Organization:
>Environment:
System: Linux jaguar 2.4.10 #1 Mon Sep 24 16:48:49 MSD 2001 i686 unknown
Architecture: i686

	
host: i386-redhat-linux-gnu
build: i386-redhat-linux-gnu
target: i386-redhat-linux-gnu
configured with: ../gcc-3.0.1/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c++,f77,java --enable-threads=posix --with-system-zlib i386-redhat-linux

Also reproduced with gcc-3.0.1 on sparc-sun-solaris2.7
>Description:
sizeof applied to a member of a nested class doesn't compile.
The diagnostics is different depending on whether sizeof appears in a
member function of the enclosing class or in a global function, but
seems to be invalid in either case.
>How-To-Repeat:
class foo {
public:
  class bar {
  public:
    int z;
  };
  void y();
};

void foo::y()
{
  int i = sizeof(foo::bar::z);
}
void y()
{
  int i = sizeof(foo::bar::z);
}

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:
 >>> g++ -c foo.cc 
 foo.cc: In member function `void foo::y()':
 foo.cc:12: cannot convert a pointer of type `foo' to a pointer of type 
    `foo::bar'
 foo.cc: In function `void y()':
 foo.cc:5: member `foo::bar::z' is non-static but referenced as a static member
 foo.cc:16: at this point in file
 


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

end of thread, other threads:[~2001-10-22  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-22  9:40 c++/4477: sizeof on nested class members doesn't compile lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2001-10-05  3:56 roman.kagan

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