2011-03-16 Jason Merrill <jason@redhat.com>
+ PR c++/46336
+ * decl.c (duplicate_decls): Return NULL_TREE for clashing
+ C functions.
+
PR c++/47570
* semantics.c (cxx_eval_constant_expression) [COMPOUND_EXPR]: Don't
use the generic binary expression handling.
error ("declaration of C function %q#D conflicts with",
newdecl);
error ("previous declaration %q+#D here", olddecl);
+ return NULL_TREE;
}
else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
2011-03-16 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/constexpr-46336.C: New.
+ * g++.dg/parse/friend5.C: Adjust expected errors.
+
* g++.dg/cpp0x/constexpr-47570.C: New.
2011-03-16 Dodji Seketeli <dodji@redhat.com>
--- /dev/null
+// PR c++/46336
+// { dg-options -std=c++0x }
+
+extern "C" {
+ enum A { };
+ inline constexpr A
+ f(A a, A b) // { dg-error "previous declaration" }
+ { return A(static_cast<int>(a) & static_cast<int>(b)); }
+ enum B { };
+ inline constexpr B
+ f(B a, B b) // { dg-error "C function" }
+ { return B(static_cast<int>(a) & static_cast<int>(b)); }
+}
+
{
friend void foo(int) {} // { dg-error "declaration" }
friend void foo() {} // { dg-error "foo" "err" }
- // { dg-warning "already a friend" "warn" { target *-*-* } 6 }
};