diff options
author | Mark Mitchell <mark@codesourcery.com> | 2004-08-25 20:06:30 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2004-08-25 20:06:30 +0000 |
commit | 6dc36fed57925986b31b724fd4869656e1d41ac0 (patch) | |
tree | 67428aaa0b5f0c6e212823941f1e976441086f48 | |
parent | 8e8d51622f9c4aca782074532ee563f4c70f2e2f (diff) | |
download | gcc-6dc36fed57925986b31b724fd4869656e1d41ac0.zip gcc-6dc36fed57925986b31b724fd4869656e1d41ac0.tar.gz gcc-6dc36fed57925986b31b724fd4869656e1d41ac0.tar.bz2 |
re PR c++/17155 (Another link problem with function-local classes)
PR c++/17155
* lex.c (build_lang_decl): Set DECL_NO_STATIC_CHAIN for all C++
functions.
PR c++/17155
* g++.dg/inherit/local2.C: New test.
From-SVN: r86571
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/lex.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/inherit/local2.C | 16 |
4 files changed, 30 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3b5498e..c895d54 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2004-08-25 Mark Mitchell <mark@codesourcery.com> + PR c++/17155 + * lex.c (build_lang_decl): Set DECL_NO_STATIC_CHAIN for all C++ + functions. + * mangle.c (get_identifier_nocopy): Add cast. * cp-tree.h (mangle_type): Remove. diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index fe220f2..fc0a5ab 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -649,6 +649,11 @@ build_lang_decl (enum tree_code code, tree name, tree type) t = build_decl (code, name, type); retrofit_lang_decl (t); + /* All nesting of C++ functions is lexical; there is never a "static + chain" in the sense of GNU C nested functions. */ + if (code == FUNCTION_DECL) + DECL_NO_STATIC_CHAIN (t) = 1; + return t; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 888b38a..0b6efa8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-25 Mark Mitchell <mark@codesourcery.com> + + PR c++/17155 + * g++.dg/inherit/local2.C: New test. + 2004-08-25 Paul Brook <paul@codesourcery.com> PR fortran/17144 diff --git a/gcc/testsuite/g++.dg/inherit/local2.C b/gcc/testsuite/g++.dg/inherit/local2.C new file mode 100644 index 0000000..82d812c --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/local2.C @@ -0,0 +1,16 @@ +// PR c++/17155 +// { dg-do link } + +struct A { + virtual ~A() {} +}; + + +void tsk_tsk(void) +{ + struct B : public A { + B(int) {} + }; +} + +int main () {} |