This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: Fix 9779
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 02 Jul 2003 10:36:12 +0100
- Subject: [PATCH]: Fix 9779
- Organization: Codesourcery LLC
Hi,
I've installed this obvious patch for 9779. We correctly consider
things like sizeof(foo) to be a non-type dependent expression. But we
don't set its type. This is the simplest fix - setting its type breaks
other things right now.
booted & tested on i686-pc-linux-gnu.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2003-07-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/9779
* decl2.c (arg_assoc_class): Don't die on NULL type.
* typeck.c (type_unknown_p): Don't die on untyped expressions.
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.633
diff -c -3 -p -r1.633 decl2.c
*** cp/decl2.c 1 Jul 2003 07:17:02 -0000 1.633
--- cp/decl2.c 1 Jul 2003 08:40:36 -0000
*************** arg_assoc_class (struct arg_lookup *k, t
*** 4031,4036 ****
--- 4037,4047 ----
static bool
arg_assoc_type (struct arg_lookup *k, tree type)
{
+ /* As we do not get the type of non-type dependent expressions
+ right, we can end up with such things without a type. */
+ if (!type)
+ return false;
+
switch (TREE_CODE (type))
{
case ERROR_MARK:
Index: cp/typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/typeck.c,v
retrieving revision 1.469
diff -c -3 -p -r1.469 typeck.c
*** cp/typeck.c 27 Jun 2003 16:24:47 -0000 1.469
--- cp/typeck.c 1 Jul 2003 08:41:54 -0000
*************** type_unknown_p (exp)
*** 183,189 ****
return (TREE_CODE (exp) == OVERLOAD
|| TREE_CODE (exp) == TREE_LIST
|| TREE_TYPE (exp) == unknown_type_node
! || (TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
&& TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
}
--- 183,193 ----
return (TREE_CODE (exp) == OVERLOAD
|| TREE_CODE (exp) == TREE_LIST
|| TREE_TYPE (exp) == unknown_type_node
! /* Until we get the type of non type-dependent expressions
! correct, we can have non-type dependent expressions with
! no type. */
! || (TREE_TYPE (exp)
! && TREE_CODE (TREE_TYPE (exp)) == OFFSET_TYPE
&& TREE_TYPE (TREE_TYPE (exp)) == unknown_type_node));
}
// { dg-do compile }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 30 Jun 2003 <nathan@codesourcery.com>
// PR c++ 9779. ICE
struct I
{
};
void Foo (int);
namespace std
{
template <typename X>
void Baz (I *x)
{
Foo (sizeof (I));
Foo (sizeof (x));
Foo (__alignof__ (I));
Foo (__alignof__ (x));
Foo (x->~I ());
// Foo (typeid (I));
Foo (delete x);
Foo (delete[] x);
Foo (throw x);
}
}