public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94003] is_constructible seems to have sideeffects
[not found] <bug-94003-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-11 18:39 ` redi at gcc dot gnu.org
2020-06-16 12:59 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-11 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94003
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |41437
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Almost certainly due to one of the bugs linked to PR 59002, probably PR 41437.
Inside the function template access checking doesn't work properly, so you can
use the private constructor, and the first instantiation of the trait gives the
wrong answer:
template <typename X> static bool why() {
Class c;
return std::is_constructible<Class>::value;
}
Then when the trait is rechecked later it has already been instantiated, and so
continues to give the wrong answer.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41437
[Bug 41437] No access control for classes in template functions
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/94003] is_constructible seems to have sideeffects
[not found] <bug-94003-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 18:39 ` [Bug libstdc++/94003] is_constructible seems to have sideeffects redi at gcc dot gnu.org
@ 2020-06-16 12:59 ` cvs-commit at gcc dot gnu.org
2020-06-16 13:02 ` ppalka at gcc dot gnu.org
2020-06-16 13:03 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-16 12:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94003
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:92bed036098928cd4659c8990e14cf7ad040e0c2
commit r11-1350-g92bed036098928cd4659c8990e14cf7ad040e0c2
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Jun 16 08:21:33 2020 -0400
c++: Improve access checking inside templates [PR41437]
This patch generalizes our existing functionality for deferring access
checking of typedefs when parsing a function or class template to now
defer all kinds of access checks until template instantiation time,
including member function and member object accesses.
Since all access checks eventually go through enforce_access, the main
component of this patch is new handling inside enforce_access to defer
the current access check if we're inside a template. The bulk of the
rest of the patch consists of removing now-unneeded code pertaining to
suppressing access checks inside templates or pertaining to
typedef-specific access handling. Renamings and other changes with no
functional impact have been split off into the followup patch.
gcc/cp/ChangeLog:
PR c++/41437
PR c++/47346
* call.c (enforce_access): Move to semantics.c.
* cp-tree.h (enforce_access): Delete.
(get_types_needing_access_check): Delete.
(add_typedef_to_current_template_for_access_check): Delete.
* decl.c (make_typename_type): Adjust accordingly. Use
check_accessibility_of_qualified_id instead of directly using
perform_or_defer_access_check.
* parser.c (cp_parser_template_declaration_after_parameters):
Don't push a dk_no_check access state when parsing a template.
* pt.c (get_types_needing_access_check): Delete.
(append_type_to_template_for_access_check_1): Delete.
(perform_typedefs_access_check): Adjust. If type_decl is a
FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
tsubst_copy instead of tsubst to substitute into type_decl so
that we substitute into the DECL_CONTEXT of a FIELD_DECL.
(append_type_to_template_for_access_check): Delete.
* search.c (accessible_p): Remove the processing_template_decl
early exit.
* semantics.c (enforce_access): Moved from call.c. If we're
parsing a template and the access check failed, add the check to
TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
(perform_or_defer_access_check): Adjust comment.
(add_typedef_to_current_template_for_access_check): Delete.
(check_accessibility_of_qualified_id): Adjust accordingly.
Exit early if the scope is dependent.
gcc/testsuite/ChangeLog:
PR c++/41437
PR c++/47346
* g++.dg/cpp2a/concepts-using2.C: Adjust.
* g++.dg/lto/20081219_1.C: Adjust.
* g++.dg/lto/20091002-1_0.C: Adjust.
* g++.dg/lto/pr65475c_0.C: Adjust.
* g++.dg/opt/dump1.C: Adjust.
* g++.dg/other/pr53574.C: Adjust.
* g++.dg/template/access30.C: New test.
* g++.dg/template/access31.C: New test.
* g++.dg/wrappers/wrapper-around-type-pack-expansion.C: Adjust.
libstdc++-v3/ChangeLog:
PR libstdc++/94003
* testsuite/20_util/is_constructible/94003.cc: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/94003] is_constructible seems to have sideeffects
[not found] <bug-94003-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 18:39 ` [Bug libstdc++/94003] is_constructible seems to have sideeffects redi at gcc dot gnu.org
2020-06-16 12:59 ` cvs-commit at gcc dot gnu.org
@ 2020-06-16 13:02 ` ppalka at gcc dot gnu.org
2020-06-16 13:03 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-16 13:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94003
Bug 94003 depends on bug 41437, which changed state.
Bug 41437 Summary: No access control for classes in template functions
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41437
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libstdc++/94003] is_constructible seems to have sideeffects
[not found] <bug-94003-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-06-16 13:02 ` ppalka at gcc dot gnu.org
@ 2020-06-16 13:03 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-16 13:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94003
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Target Milestone|--- |11.0
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-16 13:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-94003-4@http.gcc.gnu.org/bugzilla/>
2020-03-11 18:39 ` [Bug libstdc++/94003] is_constructible seems to have sideeffects redi at gcc dot gnu.org
2020-06-16 12:59 ` cvs-commit at gcc dot gnu.org
2020-06-16 13:02 ` ppalka at gcc dot gnu.org
2020-06-16 13:03 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).