From cfdc832f0d9472709f297ae5cbd37cfa34c2030f Mon Sep 17 00:00:00 2001 From: mmitchel Date: Thu, 3 Nov 2005 19:45:10 +0000 Subject: [PATCH] PR c++/21627 * pt.c (register_specialization): Update inline flags on clones.y PR c++/21627 * g++.dg/warn/inline2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106442 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 18 ++++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/warn/inline2.C | 20 ++++++++++++++++++++ 4 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/g++.dg/warn/inline2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e1edc45cbb7..625413b364f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2005-11-03 Mark Mitchell + + PR c++/21627 + * pt.c (register_specialization): Update inline flags on clones.y + 2005-11-03 Andrew Pinski PR c++/24582 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ecfc6d1573d..1efd808ff4e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1179,6 +1179,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) } else { + tree clone; /* This situation should occur only if the first specialization is an implicit instantiation, the second is an explicit specialization, and the @@ -1204,6 +1205,23 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend) there were no definition, and vice versa. */ DECL_INITIAL (fn) = NULL_TREE; 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); return fn; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9678651670f..cec54ef070e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-11-03 Mark Mitchell + + PR c++/21627 + * g++.dg/warn/inline2.C: New test. + 2005-11-03 Andrew Pinski PR middle-end/23155 diff --git a/gcc/testsuite/g++.dg/warn/inline2.C b/gcc/testsuite/g++.dg/warn/inline2.C new file mode 100644 index 00000000000..0f5f78af11c --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/inline2.C @@ -0,0 +1,20 @@ +// PR c++/21627 + +template +struct TPL +{ + TPL (){} + ~TPL (){} + void method () {} +}; + +template <> TPL::TPL (); +template <> TPL::~TPL (); +template <> void TPL::method (); + +void Foo () +{ + TPL i; + i.method (); +} + -- 2.11.4.GIT