Commit a39041fa by Mark Mitchell Committed by Mark Mitchell

re PR c++/21627 (invalid inline warning with ctor and dtor)

	PR c++/21627
	* pt.c (register_specialization): Update inline flags on clones.y
	PR c++/21627
	* g++.dg/warn/inline2.C: New test.

From-SVN: r106442
parent 98d59fe6
2005-11-03 Mark Mitchell <mark@codesourcery.com>
PR c++/21627
* pt.c (register_specialization): Update inline flags on clones.y
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> 2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/24582 PR c++/24582
......
...@@ -1179,6 +1179,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) ...@@ -1179,6 +1179,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
} }
else else
{ {
tree clone;
/* This situation should occur only if the first /* This situation should occur only if the first
specialization is an implicit instantiation, the specialization is an implicit instantiation, the
second is an explicit specialization, and the second is an explicit specialization, and the
...@@ -1204,6 +1205,23 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) ...@@ -1204,6 +1205,23 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
there were no definition, and vice versa. */ there were no definition, and vice versa. */
DECL_INITIAL (fn) = NULL_TREE; DECL_INITIAL (fn) = NULL_TREE;
duplicate_decls (spec, fn, is_friend); duplicate_decls (spec, fn, is_friend);
/* The call to duplicate_decls will have applied
[temp.expl.spec]:
An explicit specialization of a function template
is inline only if it is explicitly declared to be,
and independently of whether its function tempalte
is.
to the primary function; now copy the inline bits to
the various clones. */
FOR_EACH_CLONE (clone, fn)
{
DECL_DECLARED_INLINE_P (clone)
= DECL_DECLARED_INLINE_P (fn);
DECL_INLINE (clone)
= DECL_INLINE (fn);
}
check_specialization_namespace (fn); check_specialization_namespace (fn);
return fn; return fn;
......
2005-11-03 Mark Mitchell <mark@codesourcery.com>
PR c++/21627
* g++.dg/warn/inline2.C: New test.
2005-11-03 Andrew Pinski <pinskia@physics.uc.edu> 2005-11-03 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/23155 PR middle-end/23155
// PR c++/21627
template<typename T>
struct TPL
{
TPL (){}
~TPL (){}
void method () {}
};
template <> TPL<int>::TPL ();
template <> TPL<int>::~TPL ();
template <> void TPL<int>::method ();
void Foo ()
{
TPL<int> i;
i.method ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment