aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2021-06-07 16:06:00 -0400
committerMarek Polacek <polacek@redhat.com>2021-06-08 18:29:32 -0400
commit1afa4facb9348cac0349ff9c30066aa25a3608f7 (patch)
tree49a1e1942da2b82988682d1c7bf823be5d311d21 /gcc/cp/decl.c
parentc4574d23cb07340918793a5a98ae7bb2988b3791 (diff)
downloadgcc-1afa4facb9348cac0349ff9c30066aa25a3608f7.zip
gcc-1afa4facb9348cac0349ff9c30066aa25a3608f7.tar.gz
gcc-1afa4facb9348cac0349ff9c30066aa25a3608f7.tar.bz2
c++: explicit() ignored on deduction guide [PR100065]
When we have explicit() with a value-dependent argument, we can't evaluate it at parsing time, so cp_parser_function_specifier_opt stashes the argument into the decl-specifiers and grokdeclarator then stores it into explicit_specifier_map, which is then used when substituting the function decl. grokdeclarator stores it for constructors and conversion functions, but we also need to do it for deduction guides, otherwise we'll forget that we've seen an explicit-specifier as in the attached test. PR c++/100065 gcc/cp/ChangeLog: * decl.c (grokdeclarator): Store a value-dependent explicit-specifier even for deduction guides. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/explicit18.C: New test.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index a3687db..cbf647d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14043,6 +14043,8 @@ grokdeclarator (const cp_declarator *declarator,
storage_class = sc_none;
}
}
+ if (declspecs->explicit_specifier)
+ store_explicit_specifier (decl, declspecs->explicit_specifier);
}
else
{