aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2022-09-02 11:19:51 -0400
committerPatrick Palka <ppalka@redhat.com>2022-09-02 11:19:51 -0400
commit51c42b38e43b5283b116882529d232719b099bfc (patch)
treea6f7798576181332772fd734822dd47473ec880b /gcc/fortran
parent67b6d1be0623de1a8aa32fe249bfa0129c55b11a (diff)
downloadgcc-51c42b38e43b5283b116882529d232719b099bfc.zip
gcc-51c42b38e43b5283b116882529d232719b099bfc.tar.gz
gcc-51c42b38e43b5283b116882529d232719b099bfc.tar.bz2
libstdc++: Fix laziness of __and/or/not_
r13-2230-g390f94eee1ae69 redefined the internal logical operator traits __and_, __or_ and __not_ as alias templates that directly resolve to true_type or false_type. But it turns out using an alias template here causes the traits to be less lazy than before because we now compute the logical result immediately upon _specialization_ of the trait, and not later upon _completion_ of the specialization. So for example, in using type = __and_<A, __not_<B>>; we now compute the conjunction and thus instantiate A even though we're in a context that doesn't require completion of the __and_. What's worse is that we also compute the inner negation and thus instantiate B (for the same reason), independent of the __and_ and the value of A! Thus the traits are now less lazy and composable than before. Fortunately, the fix is cheap and straightforward: redefine these traits as class templates instead of as alias templates so that computation of the logical result is triggered by completion, not by specialization. libstdc++-v3/ChangeLog: * include/std/type_traits (__or_, __and_, __not_): Redefine as a class template instead of as an alias template. * testsuite/20_util/logical_traits/requirements/short_circuit.cc: Add more tests for conjunction and disjunction. Add corresponding tests for __and_ and __or_.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions