public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "skagget77 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/47942] Not possible to initialize a shared_ptr with a class defined in function scope, inheriting from a global scope base class
Date: Tue, 01 Mar 2011 13:58:00 -0000 [thread overview]
Message-ID: <bug-47942-4-9mAEzBC8qE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47942-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47942
--- Comment #4 from Johan Andersson <skagget77 at gmail dot com> 2011-03-01 13:58:00 UTC ---
Thanks for the quick reply and advice to use static_cast, the reinterpret_cast
was a temporary memory lapse!
The old GCC version was because I used a web-interface to verify the problem.
I'm normally on Windows and Visual C++.
(In reply to comment #3)
> (In reply to comment #2)
> > Your options are either to use C++0x mode (classes without linkage can be used
> > as template arguments in C++0x) or to upcast the pointer
>
> It seems that the change to allow local types as template args (see
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm for the
> proposal) was implemented in GCC 4.5, so you can't rely on that in 4.4
>
> So the best option is:
>
> return BasePtr(static_cast<Base*>(new InlineImpl));
next prev parent reply other threads:[~2011-03-01 13:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 13:07 [Bug c++/47942] New: " skagget77 at gmail dot com
2011-03-01 13:28 ` [Bug c++/47942] " skagget77 at gmail dot com
2011-03-01 13:37 ` redi at gcc dot gnu.org
2011-03-01 13:45 ` redi at gcc dot gnu.org
2011-03-01 13:58 ` skagget77 at gmail dot com [this message]
2011-06-05 15:25 ` pluto at agmk dot net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-47942-4-9mAEzBC8qE@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).