This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/68290] g++.dg/concepts/auto1.C FAILs
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 26 Nov 2015 16:58:22 +0000
- Subject: [Bug c++/68290] g++.dg/concepts/auto1.C FAILs
- Auto-submitted: auto-generated
- References: <bug-68290-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68290
--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> This issue is host-dependent, it doesn't reproduce with a cross to 64-bit
> SPARC.
>
> The problematic types are:
>
> (gdb) p debug_tree(t1)
> <template_type_parm fb4ccae0 auto type_0 type_6 VOID
> align 8 symtab 0 alias set -1 canonical type fb4ccae0
> index 0 level 1 orig_level 1
> chain <type_decl fb4ccb40 auto>>
>
> (gdb) p debug_tree(t2)
> <template_type_parm fb4cd0e0 auto VOID
> align 8 symtab 0 alias set -1 canonical type fb4cd0e0
> index 0 level 1 orig_level 1
> chain <type_decl fb4cd140 auto>>
>
> and they compare equal according to structural_comptypes but have distinct
> TYPE_CANONICAL (themselves actually).
IIUC that's the bug: being equivalent as per structural_comptypes, they really
should have the same TYPE_CANONICAL. The problem then comes from:
/* Make a "constrained auto" type-specifier. This is an
auto type with constraints that must be associated after
deduction. The constraint is formed from the given
CONC and its optional sequence of arguments, which are
non-null if written as partial-concept-id. */
tree
make_constrained_auto (tree con, tree args)
{
tree type = make_auto();
/* Build the constraint. */
tree tmpl = DECL_TI_TEMPLATE (con);
tree expr;
if (VAR_P (con))
expr = build_concept_check (tmpl, type, args);
else
expr = build_concept_check (build_overload (tmpl, NULL_TREE), type, args);
tree constr = make_predicate_constraint (expr);
PLACEHOLDER_TYPE_CONSTRAINTS (type) = constr;
/* Attach the constraint to the type declaration. */
tree decl = TYPE_NAME (type);
return decl;
}
The call to make_auto (make_auto_1) creates them with their TYPE_CANONICAL set
by means of canonical_type_parameter. Now canonical_type_parameter calls
structural_comptypes, which calls equivalent_placeholder_constraints, which
looks at the PLACEHOLDER_TYPE_CONSTRAINTS... which are not yet set above.
IOW, the first call to structural_comptypes on them returns false so the
TYPE_CANONICAL of the second one is not set to the first one, then the
PLACEHOLDER_TYPE_CONSTRAINTS of the second one is set so the second call to
structural_comptypes on them returns true, leading to the checking failure.