]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: double non-dep folding from finish_compound_literal [PR104565]
authorPatrick Palka <ppalka@redhat.com>
Thu, 17 Feb 2022 13:35:23 +0000 (08:35 -0500)
committerPatrick Palka <ppalka@redhat.com>
Thu, 7 Apr 2022 19:12:38 +0000 (15:12 -0400)
commitc0f38a14c8e9daf4c3f96fe9de4e9785616d5912
tree1d1a6e44171e50fd4b11f94dcea177e6a86065cc
parente95c514cadc4517b7910ead5f8c1dd5b4fd4d991
c++: double non-dep folding from finish_compound_literal [PR104565]

In finish_compound_literal, we perform non-dependent expr folding before
the call to check_narrowing ever since r9-5973.  But ever since r10-7096,
check_narrowing also performs non-dependent expr folding of its own.
This double folding means tsubst will see non-templated trees during the
second folding, which causes a spurious error in the below testcase.

This patch removes the former folding operation; it seems obviated by
the latter one.

PR c++/104565

gcc/cp/ChangeLog:

* semantics.c (finish_compound_literal): Don't perform
non-dependent expr folding before calling check_narrowing.

gcc/testsuite/ChangeLog:

* g++.dg/template/non-dependent22.C: New test.

(cherry picked from commit 6bbd8afee0036c274f5ebb5b48d6fdc2091bd046)
gcc/cp/semantics.c
gcc/testsuite/g++.dg/template/non-dependent22.C [new file with mode: 0644]