PR c++/84551 - ICE with concepts and -g.
authorJason Merrill <jason@redhat.com>
Mon, 26 Feb 2018 19:04:42 +0000 (14:04 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 26 Feb 2018 19:04:42 +0000 (14:04 -0500)
* parser.c (add_debug_begin_stmt): Do nothing in a concept.

From-SVN: r258009

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

index 7499992..bf995f0 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-26  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84551 - ICE with concepts and -g.
+       * parser.c (add_debug_begin_stmt): Do nothing in a concept.
+
 2018-02-26  Marek Polacek  <polacek@redhat.com>
 
        PR c++/84325
index 4fa546a..f305c9c 100644 (file)
@@ -10699,6 +10699,9 @@ add_debug_begin_stmt (location_t loc)
 {
   if (!MAY_HAVE_DEBUG_MARKER_STMTS)
     return;
+  if (DECL_DECLARED_CONCEPT_P (current_function_decl))
+    /* A concept is never expanded normally.  */
+    return;
 
   tree stmt = build0 (DEBUG_BEGIN_STMT, void_type_node);
   SET_EXPR_LOCATION (stmt, loc);
diff --git a/gcc/testsuite/g++.dg/concepts/debug1.C b/gcc/testsuite/g++.dg/concepts/debug1.C
new file mode 100644 (file)
index 0000000..eeb6365
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/84551
+// { dg-options "-g -O -std=c++17 -fconcepts" }
+
+template<typename> concept bool C() { return true; }
+
+template<template<typename T> requires C<T>() class> struct A {};
+
+template<typename> requires true struct B {};
+
+A<B> a;