diff options
| author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-14 18:15:35 +0000 |
|---|---|---|
| committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-14 18:15:35 +0000 |
| commit | 9129d24f31cba548a1e07ebc8691d043da1540fb (patch) | |
| tree | aa7fb51f6467b13b5c7ac8cea26573348bdb1e7b | |
| parent | 444fed4fb4a0e95c68a2bacaba5e431d39ca922e (diff) | |
| download | ppe42-gcc-9129d24f31cba548a1e07ebc8691d043da1540fb.tar.gz ppe42-gcc-9129d24f31cba548a1e07ebc8691d043da1540fb.zip | |
2007-10-14 Andrew Pinski <pinskia@gmail.com>
PR c++/30303
* decl.c (grokfndecl): Return NULL after the "definition of
implicitly-declared" error happened.
2007-10-14 Andrew Pinski <pinskia@gmail.com>
PR c++/30303
* g++.dg/other/ctor1.C: New test.
* g++.dg/other/ctor2.C: New test.
* g++.dg/other/dtor1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129298 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/decl.c | 5 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/other/ctor1.C | 11 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/other/ctor2.C | 17 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/other/dtor1.C | 17 |
6 files changed, 62 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bc25402a0e9..b81f0e82b19 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-10-14 Andrew Pinski <pinskia@gmail.com> + + PR c++/30303 + * decl.c (grokfndecl): Return NULL after the "definition of + implicitly-declared" error happened. + 2007-10-12 Simon Martin <simartin@users.sourceforge.net> PR c++/26698 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 83195af1b49..5553ec1753e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6577,7 +6577,10 @@ grokfndecl (tree ctype, XXX Isn't this done in start_function, too? */ revert_static_member_fn (decl); if (DECL_ARTIFICIAL (old_decl)) - error ("definition of implicitly-declared %qD", old_decl); + { + error ("definition of implicitly-declared %qD", old_decl); + return NULL_TREE; + } /* Since we've smashed OLD_DECL to its DECL_TEMPLATE_RESULT, we must do the same to DECL. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 157d2278a30..abfa7704ef7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-10-14 Andrew Pinski <pinskia@gmail.com> + + PR c++/30303 + * g++.dg/other/ctor1.C: New test. + * g++.dg/other/ctor2.C: New test. + * g++.dg/other/dtor1.C: New test. + 2007-10-14 Tobias Burnus <burnus@gcc.gnu.org> * gfortran.dg/bounds_check_10.f90: Fix testcase. diff --git a/gcc/testsuite/g++.dg/other/ctor1.C b/gcc/testsuite/g++.dg/other/ctor1.C new file mode 100644 index 00000000000..65449f4c691 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ctor1.C @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +// PR C++/30303 +// This used to ICE because we did not return NULL +// in grokfndecl when an error happened. + +class A +{ + int i; +}; + +A::A() { A(); } /* { dg-error "definition of implicitly-declared" } */ diff --git a/gcc/testsuite/g++.dg/other/ctor2.C b/gcc/testsuite/g++.dg/other/ctor2.C new file mode 100644 index 00000000000..65bd859027e --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ctor2.C @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +// PR C++/30303 +// This used to ICE because we did not return NULL +// in grokfndecl when an error happened. + + +class A +{ + int i; +}; + +void foo() +{ + A(); +} + +A::A() {} /* { dg-error "definition of implicitly-declared" } */ diff --git a/gcc/testsuite/g++.dg/other/dtor1.C b/gcc/testsuite/g++.dg/other/dtor1.C new file mode 100644 index 00000000000..90ca3800728 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/dtor1.C @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +// PR C++/30303 +// This used to ICE because we did not return NULL +// in grokfndecl when an error happened. + +struct Ifoo +{ +virtual ~Ifoo(){} +}; +struct foo : Ifoo +{ + foo(){}; +}; +foo::~foo() // { dg-error "definition of implicitly-declared" } +{ +delete this; +} |

