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
This commit is contained in:
Mark Mitchell 1998-08-12 14:40:39 +00:00 committed by Mark Mitchell
parent 05008fb97d
commit 49e0438549
3 changed files with 25 additions and 10 deletions

View File

@ -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.

View File

@ -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,

View File

@ -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