From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6887 invoked by alias); 3 Aug 2004 20:57:44 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6858 invoked by uid 48); 3 Aug 2004 20:57:44 -0000 Date: Tue, 03 Aug 2004 20:57:00 -0000 Message-ID: <20040803205744.6857.qmail@sourceware.org> From: "ian at wasabisystems dot com" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030603112812.11078.jtotland1@chello.no> References: <20030603112812.11078.jtotland1@chello.no> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/11078] [ABI] ICE in write_type with typeof and templates X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg00267.txt.bz2 List-Id: ------- 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 typeof(T1() + T2()) add(T1 a, T2 b) { return a+b; } static double foo = add(3.1, 'c'); When mangling add(double, char), we need to mangle the return type. The mangling ABI requires this to be a . If we are going to mangle this using typeof, then we need to be able to use an in a . 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 as an . Since typeof only cares about the types of its arguments, I think we can get away with representing a type using the existing L 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 , which will require an ABI extension. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11078