https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97536

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:29d8838c5ecaf70ce552fea7639ec1f34adb2e04

commit r11-8252-g29d8838c5ecaf70ce552fea7639ec1f34adb2e04
Author: Marek Polacek <pola...@redhat.com>
Date:   Mon Apr 19 16:21:46 2021 -0400

    c++: ICE with concept defined in function [PR97536]

    This is an ICE-on-invalid, but I keep seeing it when reducing code so
    I'd like to fix it.  We crash on

      template <typename> void forward() {
        concept C = true;
      }

    which breaks two requirements:
    [temp.concept]/1: A concept is a template ...
    [temp.concept]/3: A concept-definition shall inhabit a namespace scope.

    This patch adds a test that exercises broken code and fixes the ICE
    by checking that a concept-definition is defined at namespace scope.

    gcc/cp/ChangeLog:

            PR c++/97536
            * decl.c (grokvardecl): Given an error when a concept is not
defined
            at namespace scope.

    gcc/testsuite/ChangeLog:

            PR c++/97536
            * g++.dg/concepts/diagnostic16.C: New test.
  • [Bug c++/97536] [concepts] pars... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to