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 (