aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-08-12 14:40:39 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-08-12 14:40:39 +0000
commit49e0438549375d706a61eb78f8375ce4877e78cc (patch)
treea27939670217c893a368cc112c412511945e5bc7 /gcc
parent05008fb97d0b9316c8c4a453d6fbd3948c869442 (diff)
downloadgcc-49e0438549375d706a61eb78f8375ce4877e78cc.zip
gcc-49e0438549375d706a61eb78f8375ce4877e78cc.tar.gz
gcc-49e0438549375d706a61eb78f8375ce4877e78cc.tar.bz2
pt.c (print_template_context): Don't abort when instantiating a synthesized method.
* pt.c (print_template_context): Don't abort when instantiating a synthesized method. From-SVN: r21685
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c23
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/crash20.C9
3 files changed, 25 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fe7813b..cee17fd 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
1998-08-12 Mark Mitchell <mark@markmitchell.com>
+ * pt.c (print_template_context): Don't abort when instantiating a
+ synthesized method.
+
* decl.c (grokdeclarator): Issue errors on namespace qualified
declarators in parameter lists or in class scope.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8e0983e..319941f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3699,25 +3699,28 @@ print_template_context (err)
int line = lineno;
char *file = input_filename;
- if (err)
+ if (err && p)
{
- if (current_function_decl == p->decl)
- /* Avoid redundancy with the the "In function" line. */;
- else if (current_function_decl == NULL_TREE)
- fprintf (stderr, "%s: In instantiation of `%s':\n",
- file, decl_as_string (p->decl, 0));
+ if (current_function_decl != p->decl
+ && current_function_decl != NULL_TREE)
+ /* We can get here during the processing of some synthesized
+ method. Then, p->decl will be the function that's causing
+ the synthesis. */
+ ;
else
- my_friendly_abort (980521);
-
- if (p)
{
+ if (current_function_decl == p->decl)
+ /* Avoid redundancy with the the "In function" line. */;
+ else
+ fprintf (stderr, "%s: In instantiation of `%s':\n",
+ file, decl_as_string (p->decl, 0));
+
line = p->line;
file = p->file;
p = p->next;
}
}
- next:
for (; p; p = p->next)
{
fprintf (stderr, "%s:%d: instantiated from `%s'\n", file, line,
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash20.C b/gcc/testsuite/g++.old-deja/g++.pt/crash20.C
new file mode 100644
index 0000000..29b4281
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/crash20.C
@@ -0,0 +1,9 @@
+// Build don't link:
+
+template <class T = int>
+struct A { const T x; A() : x(0) { } A(T x) : x(x) { } };
+
+template <class B>
+void func () { B y; y = B(); } // ERROR - can't use default assignment
+
+int main (void) { func< A<> >(); } // ERROR - instantiated from here