This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/48386] "Cannot declare static function inside another function"
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Mar 2011 13:40:56 +0000
- Subject: [Bug c++/48386] "Cannot declare static function inside another function"
- Auto-submitted: auto-generated
- References: <bug-48386-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48386
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-31 13:40:52 UTC ---
(In reply to comment #2)
> all works, so I have decide that is a bug, sorry for wasted time.
It compiles, but it doesn't do what you think: it declares a function "b" not a
variable.
Try this, which shows that b is not an object of type B:
struct A {};
struct B
{
B( A ) {}
int f() { return 0; }
};
int main()
{
B b( A() );
return b.f();
}