Commit 930cd796 by Mark Mitchell Committed by Mark Mitchell

pt.c (instantiate_decl): Always instantiate static data members initialized in-class.

	* pt.c (instantiate_decl): Always instantiate static data members
	initialized in-class.

From-SVN: r37107
parent cea1f697
2000-10-28 Mark Mitchell <mark@codesourcery.com>
* pt.c (instantiate_decl): Always instantiate static data members
initialized in-class.
2000-10-27 Zack Weinberg <zack@wolery.stanford.edu> 2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
* Make-lang.in: Move all build rules here from Makefile.in, * Make-lang.in: Move all build rules here from Makefile.in,
......
...@@ -9614,12 +9614,6 @@ instantiate_decl (d, defer_ok) ...@@ -9614,12 +9614,6 @@ instantiate_decl (d, defer_ok)
import_export_decl (d); import_export_decl (d);
} }
/* Reject all external templates except inline functions. */
if (DECL_INTERFACE_KNOWN (d)
&& ! DECL_NOT_REALLY_EXTERN (d)
&& ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d)))
goto out;
/* We need to set up DECL_INITIAL regardless of pattern_defined if /* We need to set up DECL_INITIAL regardless of pattern_defined if
the variable is a static const initialized in the class body. */ the variable is a static const initialized in the class body. */
if (TREE_CODE (d) == VAR_DECL if (TREE_CODE (d) == VAR_DECL
...@@ -9627,6 +9621,11 @@ instantiate_decl (d, defer_ok) ...@@ -9627,6 +9621,11 @@ instantiate_decl (d, defer_ok)
&& DECL_INITIAL (d) == NULL_TREE && DECL_INITIAL (d) == NULL_TREE
&& DECL_INITIAL (code_pattern) != NULL_TREE) && DECL_INITIAL (code_pattern) != NULL_TREE)
; ;
/* Reject all external templates except inline functions. */
else if (DECL_INTERFACE_KNOWN (d)
&& ! DECL_NOT_REALLY_EXTERN (d)
&& ! (TREE_CODE (d) == FUNCTION_DECL && DECL_INLINE (d)))
goto out;
/* Defer all other templates, unless we have been explicitly /* Defer all other templates, unless we have been explicitly
forbidden from doing so. We restore the source position here forbidden from doing so. We restore the source position here
because it's used by add_pending_template. */ because it's used by add_pending_template. */
......
// Build don't run:
// Origin: Mark Mitchell <mark@codesourcery.com>
// Special g++ Options: -fno-implicit-templates
template <class T>
struct U {
static int j;
};
template <class T>
struct S {
static const int i = 7;
};
template <class T>
const int S<T>::i;
template <class T>
int U<T>::j = S<T>::i + 5;
template int U<double>::j;
int main () {
}
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