re PR c++/13791 (ICE in layout_type with packed types)

PR c++/13791
	* typeck.c (merge_types): Do not merge attributes into
	TYPENAME_TYPEs.

2004-01-28  Mark Mitchell  <mark@codesourcery.com>

	PR c++/13791
	* g++.dg/ext/attrib12.C: New test.

From-SVN: r76837
This commit is contained in:
Mark Mitchell 2004-01-29 02:21:51 +00:00 committed by Mark Mitchell
parent dc7efe6ea9
commit b1a95e0b15
4 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,9 @@
2004-01-28 Mark Mitchell <mark@codesourcery.com>
PR c++/13791
* typeck.c (merge_types): Do not merge attributes into
TYPENAME_TYPEs.
PR c++/13736
* parser.c (cp_parser_direct_declarator): Do not prevent
backtracking inside a parenthesized declarator.

View File

@ -714,6 +714,12 @@ merge_types (tree t1, tree t2)
break;
}
case TYPENAME_TYPE:
/* There is no need to merge attributes into a TYPENAME_TYPE.
When the type is instantiated it will have whatever
attributes result from the instantiation. */
return t1;
default:;
}
return build_type_attribute_variant (t1, attributes);

View File

@ -1,5 +1,8 @@
2004-01-28 Mark Mitchell <mark@codesourcery.com>
PR c++/13791
* g++.dg/ext/attrib12.C: New test.
PR c++/13736
* g++.dg/parse/cast2.C: New test.

View File

@ -0,0 +1,16 @@
// PR c++/13791
template <typename T> struct O {
struct __attribute__((packed)) I {
int i;
char c;
};
I* foo();
};
template <typename T>
typename O<T>::I*
O<T>::foo() { return 0; }
template class O<int>;