From 106b15eac3345e62475f6087d53711c9e33c25d5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 26 Feb 2018 14:04:42 -0500 Subject: [PATCH] PR c++/84551 - ICE with concepts and -g. * parser.c (add_debug_begin_stmt): Do nothing in a concept. From-SVN: r258009 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 3 +++ gcc/testsuite/g++.dg/concepts/debug1.C | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/concepts/debug1.C 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;