public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ian at wasabisystems dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/11078] [ABI] ICE in write_type with typeof and templates
Date: Tue, 03 Aug 2004 20:57:00 -0000	[thread overview]
Message-ID: <20040803205744.6857.qmail@sourceware.org> (raw)
In-Reply-To: <20030603112812.11078.jtotland1@chello.no>


------- Additional Comments From ian at wasabisystems dot com  2004-08-03 20:57 -------
It would be nice to be able to use something as simple as v16typeof, or
v17typeofe/v17typeoft, but it is not.  The problem is that typeof can introduce
expressions in cases where the mangling ABI does not permit them.  Consider the
test case in this PR:

template <class T1, class T2>
typeof(T1() + T2()) add(T1 a, T2 b) { return a+b; }
static double foo = add(3.1, 'c');

When mangling add<double, char>(double, char), we need to mangle the return
type.  The mangling ABI requires this to be a <type>.  If we are going to mangle
this using typeof, then we need to be able to use an <expression> in a <type>. 
But the mangling ABI does not provide any mechanism for that.

However, I note that we don't actually have to use typeof when mangling this
name.  When the compiler sees the template arguments, it can always resolve the
typeof down to a basic type.  Would it be reasonable to address the issue in
that way?

In fact, in general the compiler can resolve typeof.  In what cases will it not
be able to?

If there a case in which the compiler can not resolve typeof, I think we should
use the vendor extended operator syntax.  Separating typeoft and typeofe doesn't
actually work, because the parameter to typeof may itself be an expression
involving types.  What we need is a way to express a <type> as an
<expr-primary>.  Since typeof only cares about the types of its arguments, I
think we can get away with representing a type using the existing L <type>
<value> E syntax, and always using the value "0".

But I think we need some examples.  My current guess is that the example in this
PR should not require us to mangle typeof.  Any thoughts on this?

If it does require us to mangle typeof, then we need to decide how to express
typeof in a <type>, which will require an ABI extension.

-- 


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


  parent reply	other threads:[~2004-08-03 20:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-03 11:28 [Bug c++/11078] New: typeof and templates.... internal compiler error jtotland1@chello.no
2003-06-03 12:03 ` [Bug c++/11078] ICE with typeof and templates reichelt@gcc.gnu.org
2003-06-14 23:41 ` [Bug c++/11078] ICE in write_type " pinskia@physics.uc.edu
2003-07-20  3:20 ` pinskia at physics dot uc dot edu
2003-07-30 15:12 ` gccbugs at contacts dot eelis dot net
2003-07-30 15:30 ` reichelt at igpm dot rwth-aachen dot de
2003-08-23  0:24 ` dhazeghi at yahoo dot com
2003-09-25  1:33 ` bangerth at dealii dot org
2004-07-26 13:33 ` pinskia at gcc dot gnu dot org
2004-07-31  1:18 ` [Bug c++/11078] [ABI] " giovannibajo at libero dot it
2004-07-31 10:26 ` giovannibajo at libero dot it
2004-07-31 17:33 ` gdr at integrable-solutions dot net
2004-08-03 20:57 ` ian at wasabisystems dot com [this message]
2004-08-03 21:28 ` boris at kolpackov dot net
2004-08-03 21:40 ` bangerth at dealii dot org
2004-08-09  2:40 ` giovannibajo at libero dot it
2004-08-09 13:56 ` ian at wasabisystems dot com
2004-08-09 14:14 ` gdr at integrable-solutions dot net
2004-08-09 14:39 ` giovannibajo at libero dot it
2004-08-09 14:47 ` ian at wasabisystems dot com
2004-08-09 15:05 ` giovannibajo at libero dot it
2004-08-09 17:11 ` gdr at integrable-solutions dot net
2004-08-09 17:31 ` gdr at integrable-solutions dot net
2004-08-10  0:49 ` giovannibajo at libero dot it
2004-08-10  1:35 ` gdr at integrable-solutions dot net
2004-11-10  2:00 ` pinskia at gcc dot gnu dot org
     [not found] <bug-11078-6207@http.gcc.gnu.org/bugzilla/>
2005-12-23 15:52 ` pinskia at gcc dot gnu dot org
2007-05-12 13:44 ` pinskia at gcc dot gnu dot org
2007-05-15  1:36 ` blaisorblade_spam at yahoo dot it

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=20040803205744.6857.qmail@sourceware.org \
    --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).