+2010-02-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/42748
+ * cp-tree.h (push_tinst_level): Declare.
+ (pop_tinst_level): Likewise.
+ * pt.c (push_tinst_level): Give it external linkage.
+ (pop_tinst_level): Likewise.
+ * mangle.c (mangle_decl_string): Set the source location to that
+ of the decl while mangling.
+
2010-02-27 Simon Martin <simartin@users.sourceforge.net>
PR c++/42054
extern bool reregister_specialization (tree, tree, tree);
extern tree fold_non_dependent_expr (tree);
extern bool explicit_class_specialization_p (tree);
+extern int push_tinst_level (tree);
+extern void pop_tinst_level (void);
extern struct tinst_level *outermost_tinst_level(void);
extern bool parameter_of_template_p (tree, tree);
extern void init_template_processing (void);
mangle_decl_string (const tree decl)
{
tree result;
+ location_t saved_loc = input_location;
+ tree saved_fn = NULL_TREE;
+ bool template_p = false;
+
+ if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
+ {
+ struct tinst_level *tl = current_instantiation ();
+ if (!tl || tl->decl != decl)
+ {
+ template_p = true;
+ saved_fn = current_function_decl;
+ push_tinst_level (decl);
+ current_function_decl = NULL_TREE;
+ }
+ }
+ input_location = DECL_SOURCE_LOCATION (decl);
start_mangling (decl);
if (DEBUG_MANGLE)
fprintf (stderr, "mangle_decl_string = '%s'\n\n",
IDENTIFIER_POINTER (result));
+
+ if (template_p)
+ {
+ pop_tinst_level ();
+ current_function_decl = saved_fn;
+ }
+ input_location = saved_loc;
+
return result;
}
unification_kind_t, int, bool);
static int unify (tree, tree, tree, tree, int);
static void add_pending_template (tree);
-static int push_tinst_level (tree);
-static void pop_tinst_level (void);
static tree reopen_tinst_level (struct tinst_level *);
static tree tsubst_initializer_list (tree, tree);
static tree get_class_bindings (tree, tree, tree);
/* We're starting to instantiate D; record the template instantiation context
for diagnostics and to restore it later. */
-static int
+int
push_tinst_level (tree d)
{
struct tinst_level *new_level;
/* We're done instantiating this template; return to the instantiation
context. */
-static void
+void
pop_tinst_level (void)
{
/* Restore the filename and line number stashed away when we started
+2010-02-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/42748
+ * g++.dg/abi/mangle11.C: Adjust mangling warning locations.
+ * g++.dg/abi/mangle12.C: Likewise.
+ * g++.dg/abi/mangle20-2.C: Likewise.
+ * g++.dg/abi/mangle17.C: Likewise.
+ * g++.dg/template/cond2.C: Likewise.
+ * g++.dg/template/pr35240.C: Likewise.
+
2010-02-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43186
// { dg-options "-Wabi -fabi-version=1" }
template <typename Q>
-void f (typename Q::X) {}
+void f (typename Q::X) {} // { dg-warning "mangle" }
struct S {
typedef int X;
};
-template void f<S> (int); // { dg-warning "mangle" }
+template void f<S> (int); // { dg-message "instantiated" }
// { dg-options "-Wabi -fabi-version=1" }
template <template <typename> class Q>
-void f (typename Q<int>::X) {}
+void f (typename Q<int>::X) {} // { dg-warning "mangle" }
template <typename Q>
struct S {
typedef int X;
};
-template void f<S> (int); // { dg-warning "mangle" }
+template void f<S> (int); // { dg-message "instantiated" }
template <int I> struct S {};
-template <int I> void f (S<I + e + int (3.7)>) {}
-template void f<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" }
+template <int I> void f (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
+template void f<7>(S<7 + e + int (3.7)>); // { dg-message "instantiated" }
-template <int I> void g (S<I + e + int (3.7)>) {}
-template void g<7>(S<7 + e + int (3.7)>); // { dg-warning "mangle" }
+template <int I> void g (S<I + e + int (3.7)>) {} // { dg-warning "mangle" }
+template void g<7>(S<7 + e + int (3.7)>); // { dg-message "instantiated" }
// PR 9043
// mangled array types in templates
-template <int I> void f(int (*)[2]) {}
+template <int I> void f(int (*)[2]) {} // { dg-warning "mangled name" }
template <int I> void g(int (*)[I+2]) {}
-template void f<1>(int (*)[2]); // { dg-warning "mangled name" }
+template void f<1>(int (*)[2]); // { dg-message "instantiated" }
// { dg-final { scan-assembler "\n_?_Z1fILi1EEvPALi2E_i\[: \t\n\]" } }
template void g<1>(int (*)[3]);
// { dg-final { scan-assembler "\n_?_Z1gILi1EEvPAplT_Li2E_i\[: \t\n\]" } }
template<int X> class c;
-template<int X, int Y> int test(c<X ? : Y>&);
+template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
void test(c<2>*c2) {
- test<0, 2>(*c2); // { dg-error "omitted" }
+ test<0, 2>(*c2); // { dg-message "instantiated" }
}
template<int> struct A {};
-template<int N> A<sizeof(new int[N][N])> foo();
+template<int N> A<sizeof(new int[N][N])> foo(); // { dg-message "unimplemented" }
void bar()
{
- foo<1>(); // { dg-message "unimplemented" }
+ foo<1>(); // { dg-message "instantiated" }
}