aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/testsuite/g++.dg/template/decl1.C16
2 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6b791d5..4d3e309 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2002-03-18 Eric Botcazou <ebotcazou@multimania.com>
+
+ PR c++/3882
+ * pt.c (tsubst_decl): Move __PRETTY_FUNCTION__ handling...
+ (tsubst_expr) [DECL_STMT]: ...here. And substitute the initializer
+ only after recording the declaration.
+
2002-03-18 Jason Merrill <jason@redhat.com>
PR c++/2039
diff --git a/gcc/testsuite/g++.dg/template/decl1.C b/gcc/testsuite/g++.dg/template/decl1.C
new file mode 100644
index 0000000..50eef08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/decl1.C
@@ -0,0 +1,16 @@
+// PR c++/3882
+// Verify that variable initialization can be
+// self-referencing inside a template function.
+
+int foo(int);
+
+template <typename T>
+void bar(const T&)
+{
+ int i = foo(i);
+}
+
+void quus()
+{
+ bar(0);
+}