public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 84644 ("internal compiler error: in warn_misplaced_attr_for_class_type, at cp/decl.c:4718")
@ 2018-10-15 18:21 Paolo Carlini
  2018-10-24 21:56 ` Jason Merrill
  0 siblings, 1 reply; 12+ messages in thread
From: Paolo Carlini @ 2018-10-15 18:21 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jason Merrill, Nathan Sidwell

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

Hi,

here we ICE when, at the end of check_tag_decl we pass a DECLTYPE_TYPE 
to warn_misplaced_attr_for_class_type. I think the right fix is 
rejecting earlier a decltype with no declarator as a declaration that 
doesn't declare anything (note: all the compilers I have at hand agree). 
Tested x86_64-linux.

Thanks, Paolo.

////////////////////


[-- Attachment #2: CL_84644 --]
[-- Type: text/plain, Size: 315 bytes --]

/cp
2018-10-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84644
	* decl.c (check_tag_decl): A decltype with no declarator
	doesn't declare anything.

/testsuite
2018-10-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84644
	* g++.dg/cpp0x/decltype68.C: New.
	* g++.dg/cpp0x/decltype-33838.C: Adjust.

[-- Attachment #3: patch_84644 --]
[-- Type: text/plain, Size: 1405 bytes --]

Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 265158)
+++ cp/decl.c	(working copy)
@@ -4793,6 +4793,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs,
   if (declspecs->type
       && TYPE_P (declspecs->type)
       && ((TREE_CODE (declspecs->type) != TYPENAME_TYPE
+	   && TREE_CODE (declspecs->type) != DECLTYPE_TYPE
 	   && MAYBE_CLASS_TYPE_P (declspecs->type))
 	  || TREE_CODE (declspecs->type) == ENUMERAL_TYPE))
     declared_type = declspecs->type;
Index: testsuite/g++.dg/cpp0x/decltype-33838.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype-33838.C	(revision 265158)
+++ testsuite/g++.dg/cpp0x/decltype-33838.C	(working copy)
@@ -2,5 +2,5 @@
 // PR c++/33838
 template<typename T> struct A
 {
-  __decltype (T* foo()); // { dg-error "expected|no arguments|accept" }
+  __decltype (T* foo()); // { dg-error "expected|no arguments|declaration" }
 };
Index: testsuite/g++.dg/cpp0x/decltype68.C
===================================================================
--- testsuite/g++.dg/cpp0x/decltype68.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/decltype68.C	(working copy)
@@ -0,0 +1,7 @@
+// PR c++/84644
+// { dg-do compile { target c++11 } }
+
+template<int a>
+struct b {
+  decltype(a) __attribute__((break));  // { dg-error "declaration does not declare anything" }
+};

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

end of thread, other threads:[~2018-12-14 21:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15 18:21 [C++ Patch] PR 84644 ("internal compiler error: in warn_misplaced_attr_for_class_type, at cp/decl.c:4718") Paolo Carlini
2018-10-24 21:56 ` Jason Merrill
2018-10-26  9:37   ` Paolo Carlini
2018-10-26 16:28     ` Jason Merrill
2018-10-26 19:03       ` Paolo Carlini
2018-10-30 21:46         ` Jason Merrill
2018-10-31  5:25           ` Paolo Carlini
2018-12-13 22:22             ` Jason Merrill
2018-12-14 18:44               ` Paolo Carlini
2018-12-14 20:19                 ` Jason Merrill
2018-12-14 21:34                   ` Paolo Carlini
2018-12-14 21:43                     ` 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).