* cp-tree.h (struct tinst_level): Add in_system_header_p.
(TINST_IN_SYSTEM_HEADER_P): New macro.
(make_tinst_level): Remove.
* pt.c (lookup_template_class): Preserve DECL_IN_SYSTEM_HEADER on
the instantiated class.
(push_tinst_level): Do not use make_tinst_level. Set
TINST_IN_SYSTEM_HEADER_P.
(pop_tinst_level): Likewise.
(instantiate_class_template): Set in_system_header.
(instantiate_pending_templates): Likewise.
* tree.c (make_tinst_level): Remove.
PR c++/20145
* g++.dg/warn/Wdtor1.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97854
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-04-08 Mark Mitchell <mark@codesourcery.com>
+
+ * cp-tree.def (TINST_LEVEL): Document TINST_IN_SYSTEM_HEADER_P.
+ * cp-tree.h (struct tinst_level): Add in_system_header_p.
+ (TINST_IN_SYSTEM_HEADER_P): New macro.
+ (make_tinst_level): Remove.
+ * pt.c (lookup_template_class): Preserve DECL_IN_SYSTEM_HEADER on
+ the instantiated class.
+ (push_tinst_level): Do not use make_tinst_level. Set
+ TINST_IN_SYSTEM_HEADER_P.
+ (pop_tinst_level): Likewise.
+ (instantiate_class_template): Set in_system_header.
+ (instantiate_pending_templates): Likewise.
+ * tree.c (make_tinst_level): Remove.
+
2005-04-06 Joseph S. Myers <joseph@codesourcery.com>
* decl.c (start_decl): Apply pending #pragma weak regardless of
TINST_DECL contains the original DECL node.
TINST_LOCATION contains the location where the template is instantiated.
+ TINST_IN_SYSTEM_HEADER_P is true if the location is in a system header.
A stack of template instantiation nodes is kept through the TREE_CHAIN
fields of these nodes. */
struct tree_common common;
tree decl;
location_t locus;
+ int in_system_header_p;
};
typedef struct tinst_level_s * tinst_level_t;
(((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl)
#define TINST_LOCATION(NODE) \
(((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus)
+#define TINST_IN_SYSTEM_HEADER_P(NODE) \
+ (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->in_system_header_p)
/* in class.c */
extern tree maybe_dummy_object (tree, tree *);
extern int is_dummy_object (tree);
extern const struct attribute_spec cxx_attribute_table[];
-extern tree make_tinst_level (tree, location_t);
extern tree make_ptrmem_cst (tree, tree);
extern tree cp_build_type_attribute_variant (tree, tree);
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
= TREE_PRIVATE (TYPE_STUB_DECL (template_type));
TREE_PROTECTED (type_decl)
= TREE_PROTECTED (TYPE_STUB_DECL (template_type));
+ DECL_IN_SYSTEM_HEADER (type_decl)
+ = DECL_IN_SYSTEM_HEADER (template);
/* Set up the template information. We have to figure out which
template is the immediate parent if this is a full
return 0;
}
- new = make_tinst_level (d, input_location);
+ new = make_node (TINST_LEVEL);
+ TINST_DECL (new) = d;
+ TINST_LOCATION (new) = input_location;
+ TINST_IN_SYSTEM_HEADER_P (new) = in_system_header;
TREE_CHAIN (new) = current_tinst_level;
current_tinst_level = new;
/* Restore the filename and line number stashed away when we started
this instantiation. */
input_location = TINST_LOCATION (old);
+ in_system_header = TINST_IN_SYSTEM_HEADER_P (old);
current_tinst_level = TREE_CHAIN (old);
--tinst_depth;
++tinst_level_tick;
/* Set the input location to the template definition. This is needed
if tsubsting causes an error. */
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (pattern));
+ typedecl = TYPE_MAIN_DECL (type);
+ input_location = DECL_SOURCE_LOCATION (typedecl);
+ in_system_header = DECL_IN_SYSTEM_HEADER (typedecl);
TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
TYPE_HAS_NEW_OPERATOR (type) = TYPE_HAS_NEW_OPERATOR (pattern);
the class itself. This puts error messages involving generated
implicit functions at a predictable point, and the same point
that would be used for non-template classes. */
- typedecl = TYPE_MAIN_DECL (type);
input_location = DECL_SOURCE_LOCATION (typedecl);
unreverse_member_declarations (type);
tree last = NULL_TREE;
int reconsider;
location_t saved_loc = input_location;
+ int saved_in_system_header = in_system_header;
/* Instantiating templates may trigger vtable generation. This in turn
may require further template instantiations. We place a limit here
while (reconsider);
input_location = saved_loc;
+ in_system_header = saved_in_system_header;
}
/* Substitute ARGVEC into T, which is a list of initializers for
}
}
-/* Return a new TINST_LEVEL for DECL at location locus. */
-tree
-make_tinst_level (tree decl, location_t locus)
-{
- tree tinst_level = make_node (TINST_LEVEL);
- TREE_CHAIN (tinst_level) = NULL_TREE;
- TINST_DECL (tinst_level) = decl;
- TINST_LOCATION (tinst_level) = locus;
- return tinst_level;
-}
-
/* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the
thing pointed to by the constant. */
+2005-04-08 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/20145
+ * g++.dg/warn/Wdtor1.C: New test.
+
2005-04-06 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/17229
--- /dev/null
+// PR c++/20145
+// { dg-options "-Wnon-virtual-dtor" }
+# 1 "t.cc"
+# 1 "<built-in>"
+# 1 "<command line>"
+# 1 "t.cc"
+# 1 "include/t.h" 1 3 4
+template <int> class t
+{
+ virtual void f();
+};
+# 2 "t.cc" 2
+
+void f(void)
+{
+ t<1> h;
+}
+