@@ -1456,6 +1456,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
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))))
new file mode 100644
@@ -0,0 +1,14 @@
+// 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)); }
+}
+
@@ -4,5 +4,4 @@ extern "C" struct A
{
friend void foo(int) {} // { dg-error "declaration" }
friend void foo() {} // { dg-error "foo" "err" }
- // { dg-warning "already a friend" "warn" { target *-*-* } 6 }
};