public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "niemayer at isg dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/15076] cast to void * of parameter in call to template constructor causes compilation error
Date: Thu, 22 Apr 2004 20:21:00 -0000	[thread overview]
Message-ID: <20040422184040.14379.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040422183522.15076.niemayer@isg.de>


------- Additional Comments From niemayer at isg dot de  2004-04-22 18:40 -------
Just noticed that the sample code can be made even simpler, the second class
isn't necessary:

-------------------------------------------------------------------------------
class X 
{
public:
	void * v;
	
	X(void * v_) : v(v_) { }
};

template <class T>
class Y : public T
{
public:
	template <typename X1>
	Y(X1 & x1) : T(x1) {
		
	}
};

void test(void) {
	
	void * v = (void *)123;
	
	Y<X> * y1 = new Y<X>(v);          // works 
	Y<X> * y3 = new Y<X>(reinterpret_cast<void *>(v));  // works
	Y<X> * y2 = new Y<X>((void *)v);  // error - why??
}

------------------------------------------------------------------------------



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15076


  reply	other threads:[~2004-04-22 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-22 18:42 [Bug c++/15076] New: " niemayer at isg dot de
2004-04-22 20:21 ` niemayer at isg dot de [this message]
2004-04-22 20:36 ` [Bug c++/15076] " pinskia at gcc dot gnu dot org
2004-04-22 21:06 ` [Bug c++/15076] [3.3/3.4/3.5 regression] result of reinterpret_cast is an lvalue bangerth at dealii dot org
2004-05-03  5:07 ` pinskia at gcc dot gnu dot org
2004-06-06  3:39 ` giovannibajo at libero dot it
2004-06-09 19:07 ` mmitchel at gcc dot gnu dot org
2004-06-10 14:27 ` cvs-commit at gcc dot gnu dot org
2004-06-10 14:27 ` cvs-commit at gcc dot gnu dot org
2004-06-10 14:30 ` mmitchel at gcc dot gnu dot org

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=20040422184040.14379.qmail@sources.redhat.com \
    --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).