[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#116875: marked as done (g++-3.0: nested type converter in initializer confuses gcc)



Your message dated Thu, 29 Nov 2001 15:31:22 +0000
with message-id <20011129153122.G27354@parcelfarce.linux.theplanet.co.uk>
and subject line notabug
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 24 Oct 2001 06:07:53 +0000
>From tullmann@cs.utah.edu Wed Oct 24 01:07:53 2001
Return-path: <tullmann@cs.utah.edu>
Received: from femail40.sdc1.sfba.home.com [24.254.60.34] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 15wHCj-00019y-00; Wed, 24 Oct 2001 01:07:53 -0500
Received: from pizza.saltlk1.ut.home.com ([24.13.134.126])
          by femail40.sdc1.sfba.home.com
          (InterMail vM.4.01.03.20 201-229-121-120-20010223) with ESMTP
          id <20011024060747.IVWX25699.femail40.sdc1.sfba.home.com@pizza.saltlk1.ut.home.com>;
          Tue, 23 Oct 2001 23:07:47 -0700
Received: from pat by pizza.saltlk1.ut.home.com with local (Exim 3.32 #1 (Debian))
	id 15wHJS-0001yH-00; Wed, 24 Oct 2001 00:14:50 -0600
From: Patrick Tullmann <pat@tullmann.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: g++-3.0: nested type converter in initializer confuses gcc
X-Reportbug-Version: 1.31
X-Mailer: reportbug 1.31
Date: Wed, 24 Oct 2001 00:14:50 -0600
Message-Id: <E15wHJS-0001yH-00@pizza.saltlk1.ut.home.com>
Sender: Patrick Tullmann <tullmann@cs.utah.edu>
Delivered-To: submit@bugs.debian.org

Package: g++-3.0
Version: 1:3.0.2-0pre010922
Severity: normal
File: /usr/bin/g++-3.0

The attached file demonstrates that g++ (in Debian/testing) barfs on a
nested int conversion of a static function in a constructor expecting
an int.  (See the main local variable 'broken' in the example.)  My
expectation is that the 'broken' line is most similar to the
'alsoWorks' declaration.

The error message from g++ is: 
gcc-bug-constructor.cc:36: request for member `field' in `broken', which is of 
   non-aggregate type `Foo ()(int (*)())'

My expectation is that 'broken' should be of type `Foo'.

I wouldn't put it past the C++ spec that 'broken' really isn't what I
intend, but even if that is the case, I can't imagine that the type in
the error message is right.  (I read that as a function returning a
Foo that takes a pointer to an int-returning function as its only
argument.)

There are lots of workarounds (all the other Foo declarations in
main() have the same result), so this really isn't critical.

The g++ v2.95.4 which is also installed on my system reports the same
error message....


*** /home/pat/tmp/gcc-bug-constructor.cc
#include <cstdio>

// return type doesn't seem to matter
static long returnLong(void)
{
	return 0;
}

class Foo
{
public:
	int field;
	Foo(int f)
		: field(f)	
	{
	}
};

int main(int, char **)
{
	int ts = int(returnLong());
	Foo works(ts);

	Foo alsoWorks(static_cast<int>(returnLong()));

	Foo stillWorks(returnLong());

	Foo yetStillFine(int(0));

	// This is the problematic line:
	Foo broken(int(returnLong()));

	// Just make sure they're used:
	printf("%d, %d, %d, %d, %d\n",
	       works.field,
	       alsoWorks.field,
	       stillWorks.field,
	       yetStillFine.field,
	       broken.field);
}


-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux pizza 2.4.7 #1 Tue Jul 24 00:58:43 MDT 2001 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages g++-3.0 depends on:
ii  gcc-3.0               1:3.0.2-0pre010922 The GNU C compiler.
ii  gcc-3.0-base          1:3.0.2-0pre010922 The GNU Compiler Collection (base 
ii  libc6                 2.2.4-1            GNU C Library: Shared libraries an
ii  libstdc++3-dev        1:3.0.2-0pre010922 The GNU stdc++ library version 3 (


---------------------------------------
Received: (at 116875-close) by bugs.debian.org; 29 Nov 2001 15:31:23 +0000
>From willy@www.linux.org.uk Thu Nov 29 09:31:23 2001
Return-path: <willy@www.linux.org.uk>
Received: from parcelfarce.linux.theplanet.co.uk (www.linux.org.uk) [195.92.249.252] (exim)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 169T9n-0001Gu-00; Thu, 29 Nov 2001 09:31:23 -0600
Received: from willy by www.linux.org.uk with local (Exim 3.33 #5)
	id 169T9m-0007dP-00
	for 116875-close@bugs.debian.org; Thu, 29 Nov 2001 15:31:22 +0000
Date: Thu, 29 Nov 2001 15:31:22 +0000
From: Matthew Wilcox <willy@debian.org>
To: 116875-close@bugs.debian.org
Subject: notabug
Message-ID: <20011129153122.G27354@parcelfarce.linux.theplanet.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
Sender:  <willy@www.linux.org.uk>
Delivered-To: 116875-close@bugs.debian.org


problem lies in code, not the compiler.

-- 
Revolutions do not require corporate support.



Reply to: