diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7499992a73a..bf995f0e8ef 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-02-26 Jason Merrill + + PR c++/84551 - ICE with concepts and -g. + * parser.c (add_debug_begin_stmt): Do nothing in a concept. + 2018-02-26 Marek Polacek PR c++/84325 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 4fa546a086c..f305c9c7eba 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 index 00000000000..eeb63654243 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/debug1.C @@ -0,0 +1,10 @@ +// PR c++/84551 +// { dg-options "-g -O -std=c++17 -fconcepts" } + +template concept bool C() { return true; } + +template requires C() class> struct A {}; + +template requires true struct B {}; + +A a;