public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails @ 2020-09-15 1:22 david at doublewise dot net 2020-09-15 1:46 ` [Bug c++/97051] " mpolacek at gcc dot gnu.org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: david at doublewise dot net @ 2020-09-15 1:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 Bug ID: 97051 Summary: Evaluating is_constant_evaluated in requires clause fails Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david at doublewise dot net Target Milestone: --- The following program #include <type_traits> template<typename> requires((std::is_constant_evaluated(), true)) constexpr int a = 0; constexpr int b = a<int>; when compiled with `g++ -std=c++20` fails with <source>:9:19: error: use of invalid variable template 'a<int>' 9 | constexpr int b = a<int>; | ^~~~~~ <source>:9:19: note: constraints not satisfied Compiler returned: 1 See it live: https://godbolt.org/z/fc5cWE ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net @ 2020-09-15 1:46 ` mpolacek at gcc dot gnu.org 2020-09-15 1:48 ` mpolacek at gcc dot gnu.org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: mpolacek at gcc dot gnu.org @ 2020-09-15 1:46 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-09-15 Keywords| |rejects-valid CC| |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Confirmed. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net 2020-09-15 1:46 ` [Bug c++/97051] " mpolacek at gcc dot gnu.org @ 2020-09-15 1:48 ` mpolacek at gcc dot gnu.org 2020-09-17 14:13 ` ppalka at gcc dot gnu.org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: mpolacek at gcc dot gnu.org @ 2020-09-15 1:48 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 --- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> --- This compiles when __builtin_is_constant_evaluated is used instead. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net 2020-09-15 1:46 ` [Bug c++/97051] " mpolacek at gcc dot gnu.org 2020-09-15 1:48 ` mpolacek at gcc dot gnu.org @ 2020-09-17 14:13 ` ppalka at gcc dot gnu.org 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: ppalka at gcc dot gnu.org @ 2020-09-17 14:13 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |ppalka at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> --- Looking into it ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net ` (2 preceding siblings ...) 2020-09-17 14:13 ` ppalka at gcc dot gnu.org @ 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org 2021-04-21 15:59 ` cvs-commit at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2020-09-19 15:18 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 --- Comment #4 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:dea470d09155f2007bdd502c16614128cb6f9348 commit r11-3295-gdea470d09155f2007bdd502c16614128cb6f9348 Author: Patrick Palka <ppalka@redhat.com> Date: Sat Sep 19 11:17:41 2020 -0400 c++: std::is_constant_evaluated inside constraint [PR97051] According to [expr.const]/14, the result of substitution into an atomic constraint is manifestly constant-evaluated; this patch adjusts the call to maybe_constant_value in satisfy_atom to that effect. gcc/cp/ChangeLog: PR c++/97051 * constraint.cc (satisfy_atom): Pass true as the manifestly_const_eval argument to maybe_constant_value. gcc/testsuite/ChangeLog: PR c++/97051 * g++.dg/cpp2a/is-constant-evaluated11.C: New test. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net ` (3 preceding siblings ...) 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org @ 2021-04-21 15:59 ` cvs-commit at gcc dot gnu.org 2021-04-21 16:00 ` ppalka at gcc dot gnu.org 2021-05-20 14:22 ` ppalka at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2021-04-21 15:59 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 --- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:0c89b88daa8dffb956c77b4f22e914f42757f707 commit r10-9745-g0c89b88daa8dffb956c77b4f22e914f42757f707 Author: Patrick Palka <ppalka@redhat.com> Date: Sat Sep 19 11:17:41 2020 -0400 c++: std::is_constant_evaluated inside constraint [PR97051] According to [expr.const]/14, the result of substitution into an atomic constraint is manifestly constant-evaluated; this patch adjusts the call to maybe_constant_value in satisfy_atom to that effect. gcc/cp/ChangeLog: PR c++/97051 * constraint.cc (satisfy_atom): Pass true as the manifestly_const_eval argument to maybe_constant_value. gcc/testsuite/ChangeLog: PR c++/97051 * g++.dg/cpp2a/is-constant-evaluated11.C: New test. (cherry picked from commit dea470d09155f2007bdd502c16614128cb6f9348) ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net ` (4 preceding siblings ...) 2021-04-21 15:59 ` cvs-commit at gcc dot gnu.org @ 2021-04-21 16:00 ` ppalka at gcc dot gnu.org 2021-05-20 14:22 ` ppalka at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: ppalka at gcc dot gnu.org @ 2021-04-21 16:00 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |10.4 Resolution|--- |FIXED Status|ASSIGNED |RESOLVED --- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- Fixed for GCC 10.4/11. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/97051] Evaluating is_constant_evaluated in requires clause fails 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net ` (5 preceding siblings ...) 2021-04-21 16:00 ` ppalka at gcc dot gnu.org @ 2021-05-20 14:22 ` ppalka at gcc dot gnu.org 6 siblings, 0 replies; 8+ messages in thread From: ppalka at gcc dot gnu.org @ 2021-05-20 14:22 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97051 Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hewillk at gmail dot com --- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> --- *** Bug 100675 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-05-20 14:22 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-09-15 1:22 [Bug c++/97051] New: Evaluating is_constant_evaluated in requires clause fails david at doublewise dot net 2020-09-15 1:46 ` [Bug c++/97051] " mpolacek at gcc dot gnu.org 2020-09-15 1:48 ` mpolacek at gcc dot gnu.org 2020-09-17 14:13 ` ppalka at gcc dot gnu.org 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org 2021-04-21 15:59 ` cvs-commit at gcc dot gnu.org 2021-04-21 16:00 ` ppalka at gcc dot gnu.org 2021-05-20 14:22 ` 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).