public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ Patch] PR 28293
@ 2008-08-15 23:26 Paolo Carlini
  0 siblings, 0 replies; only message in thread
From: Paolo Carlini @ 2008-08-15 23:26 UTC (permalink / raw)
  To: Gcc Patch List; +Cc: Mark Mitchell

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

Hi,

this is not a regression, but a rather annoying segmentation fault 
because no error messages are emitted at all. The fix is simple, but 
certainly a review is needed about the exact wording of the error 
message, for example. Tested x86_64-linux.

Paolo.

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

[-- Attachment #2: CL_28293 --]
[-- Type: text/plain, Size: 256 bytes --]

/cp
2008-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* decl.c (grokfield): Check for explicit template argument lists.

/testsuite
2008-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/28293
	* g++.dg/template/crash82.C: New.

[-- Attachment #3: patch_28293 --]
[-- Type: text/plain, Size: 1919 bytes --]

Index: testsuite/g++.dg/template/crash82.C
===================================================================
*** testsuite/g++.dg/template/crash82.C	(revision 0)
--- testsuite/g++.dg/template/crash82.C	(revision 0)
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/28293
+ 
+ template<int> void foo();
+ 
+ struct A
+ {
+   typedef void foo<0>(); // { dg-error "error: explicit template argument list not allowed" } 
+ };
Index: cp/decl2.c
===================================================================
*** cp/decl2.c	(revision 139126)
--- cp/decl2.c	(working copy)
*************** grokfield (const cp_declarator *declarat
*** 758,763 ****
--- 758,764 ----
    tree value;
    const char *asmspec = 0;
    int flags = LOOKUP_ONLYCONVERTING;
+   tree name;
  
    if (init
        && TREE_CODE (init) == TREE_LIST
*************** grokfield (const cp_declarator *declarat
*** 786,796 ****
        && DECL_CONTEXT (value) != current_class_type)
      return value;
  
!   if (DECL_NAME (value) != NULL_TREE
!       && IDENTIFIER_POINTER (DECL_NAME (value))[0] == '_'
!       && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (value)), "_vptr"))
!     error ("member %qD conflicts with virtual function table field name",
! 	   value);
  
    /* Stash away type declarations.  */
    if (TREE_CODE (value) == TYPE_DECL)
--- 787,807 ----
        && DECL_CONTEXT (value) != current_class_type)
      return value;
  
!   name = DECL_NAME (value);
! 
!   if (name != NULL_TREE)
!     {
!       if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
! 	{
! 	  error ("explicit template argument list not allowed");
! 	  return error_mark_node;
! 	}
! 
!       if (IDENTIFIER_POINTER (name)[0] == '_'
! 	  && ! strcmp (IDENTIFIER_POINTER (name), "_vptr"))
! 	error ("member %qD conflicts with virtual function table field name",
! 	       value);
!     }
  
    /* Stash away type declarations.  */
    if (TREE_CODE (value) == TYPE_DECL)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-15 19:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15 23:26 [C++ Patch] PR 28293 Paolo Carlini

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