===================================================================
@@ -974,7 +974,8 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend)
&& (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
/* If different sort of thing, we already gave an error. */
&& TREE_CODE (decl) == TREE_CODE (x)
- && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl)))
+ && !comptypes (TREE_TYPE (x), TREE_TYPE (decl),
+ COMPARE_REDECLARATION))
{
if (permerror (input_location, "type mismatch with previous "
"external decl of %q#D", x))
===================================================================
@@ -0,0 +1,9 @@
+// PR c++/22556
+
+extern int foo[]; // OK
+int foo[] = {1,2,3};
+extern int foo[]; // OK
+
+void bar(){
+ extern int foo[]; // g++: ERROR -- SHOULD BE OK
+}