]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60627 ([c++1y] ICE in explicit template instantiation containing auto param...
authorAdam Butcher <adam@jessamine.co.uk>
Mon, 24 Mar 2014 20:40:15 +0000 (20:40 +0000)
committerAdam Butcher <abutcher@gcc.gnu.org>
Mon, 24 Mar 2014 20:40:15 +0000 (20:40 +0000)
Fix PR c++/60627

PR c++/60627
* parser.c (cp_parser_parameter_declaration_clause): Prevent 'auto' from
introducing an implicit function template parameter within an explicit
instantiation.

PR c++/60627
* g++.dg/cpp1y/pr60627.C: New testcase.

From-SVN: r208799

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr60627.C [new file with mode: 0644]

index 7dfb34f6bbb70f96456ad35d242f7eaa66bcdb4d..e0229906de3713bd5321088b65d651c6e9cf6b1e 100644 (file)
@@ -1,3 +1,10 @@
+2014-03-24  Adam Butcher  <adam@jessamine.co.uk>
+
+       PR c++/60627
+       * parser.c (cp_parser_parameter_declaration_clause): Prevent 'auto' from
+       introducing an implicit function template parameter within an explicit
+       instantiation.
+
 2014-03-22  Jason Merrill  <jason@redhat.com>
 
        PR c++/60574
index 46e2453e51b47c9a2d576f303a1cd5c600a2beaf..4ca08a13d64357d0f0ad9c103d3520d9723c544f 100644 (file)
@@ -18207,7 +18207,9 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
 
   (void) cleanup;
 
-  if (!processing_specialization && !processing_template_parmlist)
+  if (!processing_specialization
+      && !processing_template_parmlist
+      && !processing_explicit_instantiation)
     if (!current_function_decl
        || (current_class_type && LAMBDA_TYPE_P (current_class_type)))
       parser->auto_is_implicit_function_template_parm_p = true;
index a07de067040141dcbf03c215fa6426f6b2273e21..9f9422abdc5a0620aab69dc843b1e493a95acda9 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-24  Adam Butcher  <adam@jessamine.co.uk>
+
+       PR c++/60627
+       * g++.dg/cpp1y/pr60627.C: New testcase.
+
 2014-03-24  Alex Velenko  <Alex.Velenko@arm.com>
 
        * gcc.target/aarch64/ushr64_1.c: New.
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr60627.C b/gcc/testsuite/g++.dg/cpp1y/pr60627.C
new file mode 100644 (file)
index 0000000..9e2116e
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/60627
+// { dg-do compile { target c++1y } }
+// { dg-options "" }
+
+template<typename T> void foo(T) {}
+
+template void foo(auto);  // { dg-error "auto|does not match" }
+
+void bar()
+{
+  foo(0);
+}