pt.c (check_default_tmpl_args): Uses the parameter source location in the diagnostic.
authorJason Merrill <jason@redhat.com>
Thu, 25 Dec 2014 07:28:01 +0000 (02:28 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 25 Dec 2014 07:28:01 +0000 (02:28 -0500)
* pt.c (check_default_tmpl_args): Uses the parameter source
location in the diagnostic.
(convert_template_argument): Just return if parm is error_mark_node.

From-SVN: r219067

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/pr31432.C
gcc/testsuite/g++.dg/cpp0x/pr31442.C
gcc/testsuite/g++.dg/cpp0x/pr32115.C
gcc/testsuite/g++.dg/cpp0x/variadic40.C
gcc/testsuite/g++.dg/template/crash55.C
gcc/testsuite/g++.dg/template/crash57.C

index 4eb87127342836b429f35ecaaf20c41733c28bc3..bd5dd4955956295c27a02272bd751e7075092ed3 100644 (file)
@@ -1,5 +1,9 @@
 2014-12-25  Jason Merrill  <jason@redhat.com>
 
+       * pt.c (check_default_tmpl_args): Uses the parameter source
+       location in the diagnostic.
+       (convert_template_argument): Just return if parm is error_mark_node.
+
        PR c++/63522
        * parser.c (cp_parser_type_parameter): Call
        check_for_bare_parameter_packs on default argument.
index f5bd842df0eb4f78dfdcc105cd42ae463c605de7..21d0d3aa4e9cd78f90158c4001abea745030a8ae 100644 (file)
@@ -4578,13 +4578,8 @@ check_default_tmpl_args (tree decl, tree parms, bool is_primary,
                     parameter pack, at the end of the template
                     parameter list.  */
 
-                 if (TREE_CODE (TREE_VALUE (parm)) == PARM_DECL)
-                   error ("parameter pack %qE must be at the end of the"
-                          " template parameter list", TREE_VALUE (parm));
-                 else
-                   error ("parameter pack %qT must be at the end of the"
-                          " template parameter list", 
-                          TREE_TYPE (TREE_VALUE (parm)));
+                 error ("parameter pack %q+D must be at the end of the"
+                        " template parameter list", TREE_VALUE (parm));
 
                  TREE_VALUE (TREE_VEC_ELT (inner_parms, i)) 
                    = error_mark_node;
@@ -6524,6 +6519,9 @@ convert_template_argument (tree parm,
   tree val;
   int is_type, requires_type, is_tmpl_type, requires_tmpl_type;
 
+  if (parm == error_mark_node)
+    return error_mark_node;
+
   if (TREE_CODE (arg) == TREE_LIST
       && TREE_CODE (TREE_VALUE (arg)) == OFFSET_REF)
     {
index 1f2ea50972e7df0863895af736a57b5ff4254079..2048077c36a6144fe3bf2d9defc99a4514fe6b93 100644 (file)
@@ -4,5 +4,5 @@ template<typename..., typename> struct A // { dg-error "parameter pack" }
  static int i;
 };
 
-A<int, int> a; // { dg-error "mismatch|expected|invalid type" }
-A<char,int> b; // { dg-error "mismatch|expected|invalid type" }
+A<int, int> a;
+A<char,int> b;
index 7fd20e7ca55db342b63017fa9897760026d87864..b4c737c603c86b4fb7cc716be72015fe757aa8b1 100644 (file)
@@ -6,4 +6,4 @@ struct B
   template <template <typename...> class C> B(C<int>);
 };
 
-B b = A<int>(); // { dg-error "mismatch|expected" }
+B b = A<int>();
index 5722aa3365c42d042db5ced853ab73bb925087e6..fafa4eed313a4bdbf9e8ddb0339601b3ba1b8443 100644 (file)
@@ -1,4 +1,4 @@
 // { dg-do compile { target c++11 } }
 template<typename ...T, int = 0> struct A {}; // { dg-error "end of" }
 
-A<int> a; // { dg-error "mismatch|expected|invalid" }
+A<int> a;
index e4df9b8bdef2aaea36c8f360c7d211d2e4777e4a..e62d62cc1b6442f3a9e52294a37f8f1515daa461 100644 (file)
@@ -1,3 +1,3 @@
 // { dg-do compile { target c++11 } }
-template<typename... Values, typename T>
-struct backward_tuple {}; // { dg-error "end" }
+template<typename... Values, typename T> // { dg-error "end" }
+struct backward_tuple {};
index 7cf9f1eae80871f94e99e0d2ee6389d5ad0f9d61..9b80fd125da17b4846ab56756f3bbc862ae79a0f 100644 (file)
@@ -3,4 +3,4 @@
 template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" }
 struct A {};
 
-template<int> void foo(A<int>);     // { dg-error "mismatch|constant|template argument" }
+template<int> void foo(A<int>);        // { dg-error "cast|argument" "" { target c++98_only } }
index cf1c3c2961de4db0b59e466c5ddab8c864be19df..ad05e6aceb16f2ae6b65e49f3d71fe32dcbc43e8 100644 (file)
@@ -7,4 +7,4 @@ template<typename> struct B
     template<int(> struct C;    // { dg-error "token" }
 };
 
-A<char> a;                      // { dg-error "type/value mismatch|constant|declaration" }
+A<char> a;