Commit cb6addf4 by Jason Merrill Committed by Jason Merrill

re PR c++/42623 ([C++0x] Function template default arguments: Invalid expressions are allowed)

	PR c++/42623
	* c-common.c (c_sizeof_or_alignof_type): Return error_mark_node
	for incomplete type.

From-SVN: r158167
parent 93e9807a
2010-04-09 Jason Merrill <jason@redhat.com>
PR c++/42623
* c-common.c (c_sizeof_or_alignof_type): Return error_mark_node
for incomplete type.
PR c++/41788
* stor-layout.c (finalize_record_size): Don't change TYPE_PACKED
based on a warning flag.
......
......@@ -4390,7 +4390,7 @@ c_sizeof_or_alignof_type (location_t loc,
if (complain)
error_at (loc, "invalid application of %qs to incomplete type %qT ",
op_name, type);
value = size_zero_node;
return error_mark_node;
}
else
{
......
2010-04-09 Jason Merrill <jason@redhat.com>
PR c++/42623
* g++.dg/template/sizeof13.C: New.
2010-04-09 Kai Tietz <kai.tietz@onevision.com>
* g++.dg/other/pr35504.C: Add check for thiscall.
......
// PR c++/42623
// We should choose f(B) because f(A<undef>) involves applying sizeof to
// an incomplete class, so it is removed by SFINAE.
// { dg-do link }
struct undef;
template <typename U, int N = sizeof(U)> struct A { A(int); };
template <typename U> void f(A<U>);
template <typename U> struct B { B(int) { } };
template <typename U> void f(B<U>) { }
int main()
{
f<undef>(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment