c++: explicit(bool) malfunction with dependent expression [PR95066]
authorMarek Polacek <polacek@redhat.com>
Mon, 11 May 2020 22:28:19 +0000 (18:28 -0400)
committerMarek Polacek <polacek@redhat.com>
Wed, 13 May 2020 20:25:39 +0000 (16:25 -0400)
commit661232da72d29f8f2385d5f588727beb74360144
treef63a667eaf35b44b41cdf78ad8b451b16b083ada
parent7040894c4441fd3f9a39b0dd2d7b640e8e85808a
c++: explicit(bool) malfunction with dependent expression [PR95066]

I forgot to set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P when merging two
function declarations and as a sad consequence, we never tsubsted
the dependent explicit-specifier in tsubst_function_decl, leading to
disregarding the explicit-specifier altogether, and wrongly accepting
this test.

PR c++/95066
* decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.

* g++.dg/cpp2a/explicit16.C: New test.
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp2a/explicit16.C [new file with mode: 0644]