diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2014-06-09 19:28:37 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2014-06-09 19:28:37 +0000 |
commit | 23646391f243274745cf31e66d914061570a4c45 (patch) | |
tree | 50747cd0ece1e1409da319bdd1c34bb4d5db7516 /gcc | |
parent | 748e88da7ede35273266e9f35488a9a4dd299f84 (diff) | |
download | gcc-23646391f243274745cf31e66d914061570a4c45.zip gcc-23646391f243274745cf31e66d914061570a4c45.tar.gz gcc-23646391f243274745cf31e66d914061570a4c45.tar.bz2 |
re PR c++/22556 (extern array: compatible declaration at function scope refused)
/cp
2014-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/22556
* name-lookup.c (pushdecl_maybe_friend_1): Use comptypes.
/testsuite
2014-06-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/22556
* g++.dg/other/redecl3.C: New.
From-SVN: r211385
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/redecl3.C | 9 |
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 38a348c..6b20688 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/22556 + * name-lookup.c (pushdecl_maybe_friend_1): Use comptypes. + 2014-06-07 Jan Hubicka <hubicka@ucw.cz> * method.c (use_thunk): Use set_decl_section_name. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 2baeeb7..90f5108 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b3e391a..06bdfa6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/22556 + * g++.dg/other/redecl3.C: New. + 2014-06-09 Marc Glisse <marc.glisse@inria.fr> PR c++/54442 diff --git a/gcc/testsuite/g++.dg/other/redecl3.C b/gcc/testsuite/g++.dg/other/redecl3.C new file mode 100644 index 0000000..6d35bf5 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/redecl3.C @@ -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 +} |