mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-22 10:29:46 +08:00
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:
parent
05008fb97d
commit
49e0438549
@ -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.
|
||||
|
||||
|
23
gcc/cp/pt.c
23
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,
|
||||
|
9
gcc/testsuite/g++.old-deja/g++.pt/crash20.C
Normal file
9
gcc/testsuite/g++.old-deja/g++.pt/crash20.C
Normal 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
|
Loading…
Reference in New Issue
Block a user