* c-common.c (c_sizeof_or_alignof_type): Return error_mark_node
for incomplete type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158167
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
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.
--- /dev/null
+// 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);
+}