+2011-06-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44625
+ * decl2.c (build_anon_union_vars): Early return error_mark_node
+ for a nested anonymous struct.
+
2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49507
/* Rather than write the code to handle the non-union case,
just give an error. */
if (TREE_CODE (type) != UNION_TYPE)
- error ("anonymous struct not inside named type");
+ {
+ error ("anonymous struct not inside named type");
+ return error_mark_node;
+ }
for (field = TYPE_FIELDS (type);
field != NULL_TREE;
+2011-06-23 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44625
+ * g++.dg/template/crash107.C: New.
+ * g++.dg/template/error17.C: Adjust.
+
2011-06-23 Jason Merrill <jason@redhat.com>
PR c++/49507
--- /dev/null
+// PR c++/44625
+// { dg-do compile }
+// { dg-options "" }
+
+template<typename FP_> struct Vec { // { dg-message "note" }
+ Vec& operator^=(Vec& rhs) {
+ union {
+ struct {FP_ x,y,z;};
+ }; // { dg-error "anonymous struct" }
+ X = y*rhs.z() - z*rhs.y(); // { dg-error "not declared|no member" }
+ }
+ Vec& operator^(Vec& rhs) {
+ return Vec(*this)^=rhs; // { dg-message "required" }
+ }
+};
+Vec<double> v(3,4,12); // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 16 }
+Vec<double> V(12,4,3); // { dg-error "no matching" }
+// { dg-message "note" { target *-*-* } 18 }
+Vec<double> c = v^V; // { dg-message "required" }
{
union { struct { }; }; // { dg-error "prohibits anonymous struct" "anon" }
// { dg-error "not inside" "not inside" { target *-*-* } 7 }
- // { dg-warning "no members" "no members" { target *-*-* } 7 }
}