From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 09653388702E; Mon, 13 Apr 2020 21:04:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09653388702E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586811894; bh=4msPATfa+oysLEpuxrfxNUuQWpMO0y+OejY8As0d994=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SeAwW3XadWOcAzwM8S1hMQ6nGWrcK7yKGotzEymgk7YPBSk/ZIvdvwRi6lZNL6rOn NfA9UUA2oucG4zN+4gPYRg6XblifoEdq79TCsCU5N5EwDC+OVrmK8mXAaBVV38WXEN XaKBKPJbJmnokGNpm9HHQBPOuaUztLmT9/vjZwJs= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94521] Infinite loop with decltype of function parameter of type decltype([]{}) Date: Mon, 13 Apr 2020 21:04:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 21:04:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94521 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:1dcb779916502a44b4ae67d6bf60eb59474bd78c commit r10-7705-g1dcb779916502a44b4ae67d6bf60eb59474bd78c Author: Patrick Palka Date: Mon Apr 13 16:53:41 2020 -0400 c++: Infinite diagnostic loop with decltype([]{}) [PR94521] We are hitting a recursive loop when printing the signature of a functi= on containing a decltype([]{}) type. The loop is dump_function_decl -> dump_substitution -> dump_template_bindings -> dump_type -> dump_aggr_type -> dump_scope -> dump_function_decl and we loop because dump_template_bindings wants to print the resolved = type of decltype([]{}) (i.e. just a lambda type), so it calls dump_aggr_type, w= hich wants to print the function scope of the lambda type. But the function scope of the lambda type is the function which we're in the middle of printing. This patch breaks the loop by passing TFF_NO_FUNCTION_ARGUMENTS to dump_function_decl from dump_scope, so that we avoid recursing into dump_substitution and ultimately looping. This also means we no longer emit the "[with ...]" clause when printing= a function template scope, and we instead just emit its template argument list in a more natural way, e.g. instead of foo(int, char) [with T=3Dbool]::x we would now print foo::x which seems like an improvement on its own. The full signature of the function 'spam' in the below testcase is now void spam(decltype ()*) [with T =3D int; decltype () = =3D spam::] gcc/cp/ChangeLog: PR c++/94521 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to dump_function_decl when printing a function template instantiat= ion as a scope. gcc/testsuite/ChangeLog: PR c++/94521 * g++.dg/cpp2a/lambda-uneval12.C: New test.=