]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Nov 2018 09:33:18 +0000 (09:33 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 19 Nov 2018 09:33:18 +0000 (09:33 +0000)
2018-11-18  Paolo Carlini  <paolo.carlini@oracle.com>

* decl2.c (grokfield): Remove obsolete _vptr check; fix
explicit template argument list error location.

/testsuite
2018-11-18  Paolo Carlini  <paolo.carlini@oracle.com>

* g++.dg/template/crash91.C: Check location too.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266264 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash91.C

index 6d99d6a5d79fd4c8284e3f4029611defb84d6edd..6f60f0d57f943e8b1156fb79e017a4f7c4d5a38a 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * decl2.c (grokfield): Remove obsolete _vptr check; fix
+       explicit template argument list error location.
+
 2018-11-16  Kamlesh Kumar  <kamleshbhalui@gmail.com>
 
        DR 1207
index 04537417129c90adca706da8253029de9f24f956..7686a908631a2fccb294fd8ac87673f7143a6a57 100644 (file)
@@ -804,7 +804,6 @@ grokfield (const cp_declarator *declarator,
   tree value;
   const char *asmspec = 0;
   int flags;
-  tree name;
 
   if (init
       && TREE_CODE (init) == TREE_LIST
@@ -829,21 +828,12 @@ grokfield (const cp_declarator *declarator,
   if (value == void_type_node)
     return value;
 
-
-  name = DECL_NAME (value);
-
-  if (name != NULL_TREE)
+  if (DECL_NAME (value)
+      && TREE_CODE (DECL_NAME (value)) == TEMPLATE_ID_EXPR)
     {
-      if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
-       {
-         error ("explicit template argument list not allowed");
-         return error_mark_node;
-       }
-
-      if (IDENTIFIER_POINTER (name)[0] == '_'
-         && id_equal (name, "_vptr"))
-       error ("member %qD conflicts with virtual function table field name",
-              value);
+      error_at (declarator->id_loc,
+               "explicit template argument list not allowed");
+      return error_mark_node;
     }
 
   /* Stash away type declarations.  */
index 4db71445888504acd61bb293191a08abd963ee26..e1f0ac6b0cc6a3bfb64b8a3437d71753ba998944 100644 (file)
@@ -1,3 +1,7 @@
+2018-11-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * g++.dg/template/crash91.C: Check location too.
+
 2018-11-19  Martin Liska  <mliska@suse.cz>
 
        PR gcov-profile/88045
index 39575cd9f272d817951b0361bd5d93b2bacb70db..6fda320ee958e6c0ca68052c4db408aaf5ab4a0b 100644 (file)
@@ -4,5 +4,5 @@ template<int> void foo();
 
 struct A
 {
-  typedef void foo<0>(); // { dg-error "explicit template argument list not allowed" } 
+  typedef void foo<0>(); // { dg-error "16:explicit template argument list not allowed" } 
 };