Commit fd852454 by Richard Henderson Committed by Richard Henderson

tree.c (cp_cannot_inline_tree_fn): Don't short-circuit test after template instantiation.

        * tree.c (cp_cannot_inline_tree_fn): Don't short-circuit test
        after template instantiation.
	* g++.dg/opt/inline3.C: New.

From-SVN: r54687
parent 9d321f6c
2002-06-16 Richard Henderson <rth@redhat.com> 2002-06-16 Richard Henderson <rth@redhat.com>
PR opt/6793
* tree.c (cp_cannot_inline_tree_fn): Don't short-circuit test
after template instantiation.
2002-06-16 Richard Henderson <rth@redhat.com>
* cp-tree.h, decl2.c (flag_ms_extensions): Move to c-common. * cp-tree.h, decl2.c (flag_ms_extensions): Move to c-common.
2002-06-15 Gabriel Dos Reis <gdr@codesourcery.com> 2002-06-15 Gabriel Dos Reis <gdr@codesourcery.com>
......
...@@ -2162,7 +2162,8 @@ cp_cannot_inline_tree_fn (fnp) ...@@ -2162,7 +2162,8 @@ cp_cannot_inline_tree_fn (fnp)
&& TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn))) && TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
{ {
fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0); fn = *fnp = instantiate_decl (fn, /*defer_ok=*/0);
return TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)); if (TI_PENDING_TEMPLATE_FLAG (DECL_TEMPLATE_INFO (fn)))
return 1;
} }
if (varargs_function_p (fn)) if (varargs_function_p (fn))
......
// PR opt/6793
// We failed to supress inlining of a varargs function when it's a template.
// { dg-do compile }
// { dg-options "-O3" }
#include <stdarg.h>
typedef __SIZE_TYPE__ size_t;
template < class Type > class VectorNd
{
size_t size;
Type *data;
public:
VectorNd (size_t _size, size_t count, ...)
: size (_size)
{
data = new Type[size];
va_list ap;
va_start (ap, count);
for (size_t i = 0; i < count; i++)
data[i] = va_arg (ap, Type);
va_end (ap);
}
~VectorNd ()
{
delete [] data;
}
};
int main ()
{
VectorNd <double> vector (3, 3, 1.0, 2.0, 3.0);
}
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