public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR c++/92024
@ 2019-10-10 15:19 Bernd Edlinger
  2019-10-10 17:50 ` Jason Merrill
  0 siblings, 1 reply; 11+ messages in thread
From: Bernd Edlinger @ 2019-10-10 15:19 UTC (permalink / raw)
  To: gcc-patches, Jason Merrill, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 207 bytes --]

Hi,

this fixes a crash when -Wshadow=compatible-local is
enabled in the testcase g++.dg/parse/crash68.C


Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?


Thanks
Bernd.

[-- Attachment #2: patch-pr92024.diff --]
[-- Type: application/octet-stream, Size: 1231 bytes --]

2019-10-10  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/92024
	* pt.c (instantiate_class_template_1): Avoid crash when
	CLASSTYPE_TEMPLATE_INFO is NULL.

testsuite:
2019-10-10  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR c++/92024
	* g++.dg/parse/crash68.C: Add -Wshadow=compatible-local to additional
	options.

Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 276634)
+++ gcc/cp/pt.c	(working copy)
@@ -10973,6 +10973,9 @@ instantiate_class_template_1 (tree type)
       || uses_template_parms (type))
     return type;
 
+  if (CLASSTYPE_TEMPLATE_INFO (type) == NULL)
+    return error_mark_node;
+
   /* Figure out which template is being instantiated.  */
   templ = most_general_template (CLASSTYPE_TI_TEMPLATE (type));
   gcc_assert (TREE_CODE (templ) == TEMPLATE_DECL);
Index: gcc/testsuite/g++.dg/parse/crash68.C
===================================================================
--- gcc/testsuite/g++.dg/parse/crash68.C	(revision 276634)
+++ gcc/testsuite/g++.dg/parse/crash68.C	(working copy)
@@ -1,4 +1,6 @@
 // PR c++/84611
+// PR c++/92024
+// { dg-additional-options "-Wshadow=compatible-local" }
 
 template<typename = int>
 struct a {

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-10-30 19:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 15:19 [PATCH] Fix PR c++/92024 Bernd Edlinger
2019-10-10 17:50 ` Jason Merrill
2019-10-10 18:23   ` Bernd Edlinger
2019-10-10 18:26     ` Marek Polacek
2019-10-11 16:34     ` Jason Merrill
2019-10-11 17:07       ` Bernd Edlinger
2019-10-12 18:49       ` Bernd Edlinger
2019-10-12 18:56         ` Sandra Loosemore
2019-10-18 13:21         ` Bernd Edlinger
2019-10-26  9:01           ` [PING**2] " Bernd Edlinger
2019-10-30 20:26         ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).