OSDN Git Service

Implement DR 757: It's OK for a decl to use a type without linkage
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Aug 2009 20:47:55 +0000 (20:47 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Aug 2009 20:47:55 +0000 (20:47 +0000)
commit74d6b34bc5210929bf52593bd9e536acbf6e6d4e
treea4546f632af854bec30da3734e864ea5f11269f0
parentb7bf3d2595470b8de52b0ccc58b04e6a4065658a
Implement DR 757: It's OK for a decl to use a type without linkage
so long as the decl is defined in the current translation unit.
* decl2.c (no_linkage_decls): New vector.
(mark_used): Add decls that use types with no linkage.
(cp_write_global_declarations): Check that they are defined.
(decl_defined_p, no_linkage_error): New fns.
* cp-tree.h (DECL_NO_LINKAGE_CHECKED): New macro.
(struct lang_decl_base): Add flag.
* decl.c (grokfndecl): Don't check type linkage.
(grokvardecl): If the type has no linkage, just make sure
DECL_LANG_SPECIFIC is set.
* pt.c (check_instantiated_arg): Don't check type linkage.
* name-lookup.c (is_local_extern): New fn.
* name-lookup.h: Declare it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150634 138bc75d-0d04-0410-961f-82ee72b054a4
19 files changed:
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/name-lookup.c
gcc/cp/name-lookup.h
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/anon-struct4.C
gcc/testsuite/g++.dg/lookup/anon2.C
gcc/testsuite/g++.dg/other/anon3.C
gcc/testsuite/g++.dg/other/linkage2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/arg2.C
gcc/testsuite/g++.dg/template/local4.C
gcc/testsuite/g++.old-deja/g++.law/operators32.C
gcc/testsuite/g++.old-deja/g++.other/anon9.C
gcc/testsuite/g++.old-deja/g++.other/linkage1.C
gcc/testsuite/g++.old-deja/g++.other/linkage2.C
gcc/testsuite/g++.old-deja/g++.pt/enum6.C