aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-01-24 11:47:13 -0500
committerPatrick Palka <ppalka@redhat.com>2022-01-24 11:47:13 -0500
commitb1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9 (patch)
treedac41103080fcdb4277a7d9263981ea00dec0b9f /gcc/cp
parent2a908f3da07c9e94b8a19e966b45daf0140107e8 (diff)
downloadgcc-b1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9.zip
gcc-b1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9.tar.gz
gcc-b1aa2a3cf1ba233ccd5a49fde85a2ca7e5f620e9.tar.bz2
c++: Fix non-portable default argument of make_auto_1 [PR104197]
Avoid using the macro current_template_depth, which expands to an expression that uses __FUNCTION__, within the signature of a function. PR c++/104197 gcc/cp/ChangeLog: * pt.cc (make_auto_1): Use -1 as a placeholder default argument for level.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index bba62a5..8f50b9c 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -28477,9 +28477,10 @@ make_args_non_dependent (vec<tree, va_gc> *args)
by default. If set_canonical is true, we set TYPE_CANONICAL on it. */
static tree
-make_auto_1 (tree name, bool set_canonical,
- int level = current_template_depth + 1)
+make_auto_1 (tree name, bool set_canonical, int level = -1)
{
+ if (level == -1)
+ level = current_template_depth + 1;
tree au = cxx_make_type (TEMPLATE_TYPE_PARM);
TYPE_NAME (au) = build_decl (input_location, TYPE_DECL, name, au);
TYPE_STUB_DECL (au) = TYPE_NAME (au);