[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Jonathan Wakely changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED Target Milestone|--- |12.0 --- Comment #12 from Jonathan Wakely --- (In reply to Martin Liška from comment #10) > Can the bug be marked as resolved? At the time you asked, no, because the third example still failed. But it compiles since r12-6382 (PR89074, as Andrew suggested). So now it can be closed as fixed in GCC 12.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=89074 --- Comment #11 from Andrew Pinski --- I think the last example is similar to bug 89074 comment #5.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Martin Liška changed: What|Removed |Added CC||marxin at gcc dot gnu.org --- Comment #10 from Martin Liška --- Can the bug be marked as resolved?
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Andrew Pinski changed: What|Removed |Added Target Milestone|6.5 |---
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Richard Biener changed: What|Removed |Added Target Milestone|6.4 |6.5 --- Comment #9 from Richard Biener --- GCC 6.4 is being released, adjusting target milestone.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Jakub Jelinek changed: What|Removed |Added Target Milestone|6.3 |6.4 --- Comment #8 from Jakub Jelinek --- GCC 6.3 is being released, adjusting target milestone.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Richard Biener changed: What|Removed |Added Target Milestone|6.2 |6.3
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Jakub Jelinek changed: What|Removed |Added Target Milestone|6.0 |6.2 --- Comment #7 from Jakub Jelinek --- GCC 6.1 has been released.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|NEW Assignee|mpolacek at gcc dot gnu.org|unassigned at gcc dot gnu.org Target Milestone|5.0 |6.0 --- Comment #6 from Marek Polacek mpolacek at gcc dot gnu.org --- I think that fixing the third case is going to be harder, and doesn't look like something that should be fixed in cp/constexpr.c. While fold_comparison is able to fold the NE_EXPR here: constexpr char s1[] = s1; constexpr char s2[] = s2; constexpr auto eq = (s2 + 2) != (s2 + 1); it isn't able to fold it here: constexpr char s1[] = s1; constexpr char s2[] = s2; constexpr auto eq = (s1 + 2) != (s2 + 1); So not sure what to do here, but in any case, I think it is a GCC 6 material.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Marek Polacek mpolacek at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2015-04-01 CC||mpolacek at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org Target Milestone|--- |5.0 Ever confirmed|0 |1 --- Comment #2 from Marek Polacek mpolacek at gcc dot gnu.org --- I'll take a look.
[Bug c++/65642] [C++11] GCC rejects valid constant expression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65642 Mitsuru Kariya kariya_mitsuru at hotmail dot com changed: What|Removed |Added Summary|GCC rejects valid constant |[C++11] GCC rejects valid |expression |constant expression --- Comment #1 from Mitsuru Kariya kariya_mitsuru at hotmail dot com --- Please see the sample codes below. == sample code 1 == constexpr char f(const char* s) { return *(s + 1); } constexpr char s[] = ss; constexpr auto c = f(s[0]); int main() {} == sample code 1 == = error message 1 = sample1.cpp:8:21: in constexpr expansion of 'f(( s[0]))' sample1.cpp:8:27: error: '*(s + 1u)' is not a constant expression constexpr auto c = f(s[0]); ^ = error message 1 = == sample code 2 == constexpr bool g(char const* found, char const* last) { return found == last; } constexpr bool f(const char* s) { return g(s, s + 1); } constexpr char s[] = ss; constexpr auto b = f(s[0]); int main() {} == sample code 2 == = error message 2 = sample2.cpp:2:15: error: '(( s[0]) == (( s[0]) + 1u))' is not a constant expression return found == last; ^ = error message 2 = == sample code 3 == constexpr char s1[] = s1; constexpr char s2[] = s2; constexpr auto eq = (s1 + 0) == (s2 + 1); int main() {} == sample code 3 == = error message 3 = sample3.cpp:4:30: error: '(((const char*)( s1)) == (((const char*)( s2)) + 1u))' is not a constant expression constexpr auto eq = (s1 + 0) == (s2 + 1); ^ = error message 3 = The sample code 1 and 2 are compiled successfully on the 4.9.2, but they cause an error on the head revision. The sample code 3 causes an error on the 4.9.2 and the head revision. These testcases are derived from bug 65398.