re PR c++/29077 (Incorrect error message for destructor in wrong namespace)

2007-03-28  Simon Martin  <simartin@users.sourceforge.net>

	PR c++/29077
	* decl.c (grokfndecl): Properly setup decl if it is a constructor or a
	destructor.

From-SVN: r123312
This commit is contained in:
Simon Martin 2007-03-28 21:06:01 +00:00 committed by Simon Martin
parent 8975ae2285
commit 71aea5f2e0
4 changed files with 40 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2007-03-28 Simon Martin <simartin@users.sourceforge.net>
PR c++/29077
* decl.c (grokfndecl): Properly setup decl if it is a constructor or a
destructor.
2007-03-28 Douglas Gregor <doug.gregor@gmail.com>
* parser.c (struct cp_parser): Update comment for

View File

@ -5981,6 +5981,20 @@ grokfndecl (tree ctype,
if (TYPE_VOLATILE (type))
TREE_THIS_VOLATILE (decl) = 1;
/* Setup decl according to sfk. */
switch (sfk)
{
case sfk_constructor:
case sfk_copy_constructor:
DECL_CONSTRUCTOR_P (decl) = 1;
break;
case sfk_destructor:
DECL_DESTRUCTOR_P (decl) = 1;
break;
default:
break;
}
if (friendp
&& TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR)
{
@ -6168,12 +6182,7 @@ grokfndecl (tree ctype,
return decl;
if (ctype != NULL_TREE)
{
if (sfk == sfk_constructor)
DECL_CONSTRUCTOR_P (decl) = 1;
grokclassfn (ctype, decl, flags);
}
grokclassfn (ctype, decl, flags);
decl = check_explicit_specialization (orig_declarator, decl,
template_count,

View File

@ -1,3 +1,8 @@
2007-03-28 Simon Martin <simartin@users.sourceforge.net>
PR c++/29077
* g++.dg/parse/constructor3.C: New test.
2007-03-28 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/thin_pointer.ad[sb]: New test.

View File

@ -0,0 +1,14 @@
/* PR c++/29077 */
/* { dg-do "compile" } */
class c {
c();
c(const c&);
~c();
};
namespace m {
c::c() {} /* { dg-error "c::c" } */
c::c(const c&) {} /* { dg-error "c::c" } */
c::~c() {} /* { dg-error "c::~c" } */
}