+2002-02-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * decl.c (grokdeclarator): Set typedef_decl for all TYPE_DECLs,
+ remove incorrect comment. Move #if 0'd code to common path. Use
+ IMPLICIT_TYPENAME_P. Simplify & reformat ARRAY_TYPE duplication.
+
2002-02-13 Jason Merrill <jason@redhat.com>
* decl.c (builtin_function): Set TREE_THIS_VOLATILE on return fns.
PR c++/109
* decl.c (grokdeclarator): Allow friend declarations from
- dependant types.
+ dependent types.
* decl2.c (handle_class_head): Don't push into template parm contexts.
* pt.c (push_template_decl_real): Template parm contexts are never
being defined.
}
}
}
- /* C++ aggregate types. */
else if (TREE_CODE (id) == TYPE_DECL)
{
if (type)
{
type = TREE_TYPE (id);
TREE_VALUE (spec) = type;
+ typedef_decl = id;
}
goto found;
}
else
{
type = TREE_TYPE (t);
-#if 0
- /* See the code below that used this. */
- decl_attr = DECL_ATTRIBUTES (id);
-#endif
typedef_decl = t;
}
}
found: ;
}
+#if 0
+ /* See the code below that used this. */
+ if (typedef_decl)
+ decl_attr = DECL_ATTRIBUTES (typedef_decl);
+#endif
typedef_type = type;
/* No type at all: default to `int', and set DEFAULTED_INT
type = integer_type_node;
}
- if (type && TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
+ if (type && IMPLICIT_TYPENAME_P (type))
{
/* The implicit typename extension is deprecated and will be
removed. Warn about its use now. */
/* Detect the case of an array type of unspecified size
which came, as such, direct from a typedef name.
- We must copy the type, so that each identifier gets
- a distinct type, so that each identifier's size can be
- controlled separately by its own initializer. */
+ We must copy the type, so that the array's domain can be
+ individually set by the object's initializer. */
- if (type != 0 && typedef_type != 0
- && TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == 0
+ if (type && typedef_type
+ && TREE_CODE (type) == ARRAY_TYPE && !TYPE_DOMAIN (type)
&& TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (typedef_type))
- {
- type = build_cplus_array_type (TREE_TYPE (type), TYPE_DOMAIN (type));
- }
+ type = build_cplus_array_type (TREE_TYPE (type), NULL_TREE);
/* Detect where we're using a typedef of function type to declare a
function. last_function_parms will not be set, so we must create
--- /dev/null
+// { dg-do run }
+// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
+
+typedef int Int;
+typedef signed int SInt;
+typedef unsigned int UInt;
+
+struct A
+{
+ SInt bitS : 1; // signed
+ UInt bitU : 1; // unsigned
+ Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
+};
+
+int main ()
+{
+ A a;
+
+ a.bitS = 1;
+ a.bitU = 1;
+ a.bit = 1;
+
+ if (a.bitS != -1)
+ return 1;
+ if (a.bitU != 1)
+ return 2;
+ if (a.bit != 1)
+ return 3;
+
+ return 0;
+}
--- /dev/null
+// { dg-do run }
+// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
+
+typedef int Int;
+typedef signed int SInt;
+typedef unsigned int UInt;
+
+struct A
+{
+ SInt bitS : 1; // signed
+ UInt bitU : 1; // unsigned
+ Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
+};
+
+int main ()
+{
+ A a;
+
+ a.bitS = 1;
+ a.bitU = 1;
+ a.bit = 1;
+
+ if (a.bitS != -1)
+ return 1;
+ if (a.bitU != 1)
+ return 2;
+ if (a.bit != -1)
+ return 3;
+
+ return 0;
+}