This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] [PR19208] Completely fold array domains


PR 19208 is about an array domain containing dependent expressions which was
not completely folded during template instantiation. The bug is basically a
relic of using old incomplete functions to fold things in templates: we now
have our cute sledgehammer for this kind of things (fold_decl_constant_value),
so using it instead of integer_constant_value is enough to fix this bug. More
to the detail, it was the presence of a scope_ref to confuse the code: I think
this appeared with Kriang's changes (somewhere in 2003) to always keep
synctatic form in templates for the purpose of access checking.

Notice also that I rearranged the loop in fold_decl_constant_value to make sure
that we call fold_non_dependent_expr at least one, thus making the function
more generically useful.

Tested on i686-pc-linux-gnu with no new regressions. OK for mainline and 3.4?

Giovanni Bajo

        PR c++/19208
        * pt.c (fold_decl_constant_value): Always call fold_non_dependent_expr
        at least once.
        (tsubst): Use fold_decl_constant_value in place of a bare call to

        PR c++/19208
        * g++.dg/template/array11.C: New test.

Attachment: patch-pr19208.txt
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]