public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr
@ 2014-12-19 5:55 sneves at dei dot uc.pt
2015-01-12 16:24 ` [Bug c++/64356] " ville.voutilainen at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: sneves at dei dot uc.pt @ 2014-12-19 5:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64356
Bug ID: 64356
Summary: Some constexpr expressions not recognized as constexpr
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sneves at dei dot uc.pt
Consider the following snippet:
template<size_t N>
constexpr uint64_t f(const char (&x)[N]) {
uint64_t s = 0;
#if defined(FAILS)
for(uint64_t c : x)
s += c;
#else
for(size_t i = 0; i < N; ++i)
s += x[i];
#endif
return s;
}
template<size_t N>
constexpr uint64_t g(const char (&x)[N]) {
char y[N] = {0};
for(size_t i = 0; i < N; ++i)
y[i] = x[i];
#if defined(FAILS)
return f(y);
#else
return f(x);
#endif
}
constexpr auto x = g(__DATE__);
When FAILS is defined, GCC (trunk, 20141219) refuses to recognize x as a
constant expression, while with FAILS undefined it works as expected. Clang
accepts both variants.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64356] Some constexpr expressions not recognized as constexpr
2014-12-19 5:55 [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr sneves at dei dot uc.pt
@ 2015-01-12 16:24 ` ville.voutilainen at gmail dot com
2015-01-13 14:45 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-12 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64356
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-01-12
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64356] Some constexpr expressions not recognized as constexpr
2014-12-19 5:55 [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr sneves at dei dot uc.pt
2015-01-12 16:24 ` [Bug c++/64356] " ville.voutilainen at gmail dot com
@ 2015-01-13 14:45 ` jason at gcc dot gnu.org
2015-01-13 21:05 ` jason at gcc dot gnu.org
2015-01-15 20:46 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-13 14:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64356
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64356] Some constexpr expressions not recognized as constexpr
2014-12-19 5:55 [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr sneves at dei dot uc.pt
2015-01-12 16:24 ` [Bug c++/64356] " ville.voutilainen at gmail dot com
2015-01-13 14:45 ` jason at gcc dot gnu.org
@ 2015-01-13 21:05 ` jason at gcc dot gnu.org
2015-01-15 20:46 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-13 21:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64356
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jan 13 21:04:43 2015
New Revision: 219559
URL: https://gcc.gnu.org/viewcvs?rev=219559&root=gcc&view=rev
Log:
PR c++/64356
PR libstdc++/58777
* constexpr.c (cxx_eval_binary_expression): Don't VERIFY_CONSTANT
pointer expressions.
(cxx_eval_increment_expression): Likewise.
Added:
trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-local2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/testsuite/g++.dg/cpp1y/pr63996.C
trunk/libstdc++-v3/testsuite/experimental/optional/constexpr/make_optional.cc
trunk/libstdc++-v3/testsuite/experimental/optional/constexpr/observers/2.cc
trunk/libstdc++-v3/testsuite/experimental/optional/constexpr/observers/3.cc
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64356] Some constexpr expressions not recognized as constexpr
2014-12-19 5:55 [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr sneves at dei dot uc.pt
` (2 preceding siblings ...)
2015-01-13 21:05 ` jason at gcc dot gnu.org
@ 2015-01-15 20:46 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-15 20:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64356
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Thu Jan 15 20:46:09 2015
New Revision: 219687
URL: https://gcc.gnu.org/viewcvs?rev=219687&root=gcc&view=rev
Log:
PR c++/64356
* constexpr.c (cxx_eval_binary_expression): Fix pasto.
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-15 20:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19 5:55 [Bug c++/64356] New: Some constexpr expressions not recognized as constexpr sneves at dei dot uc.pt
2015-01-12 16:24 ` [Bug c++/64356] " ville.voutilainen at gmail dot com
2015-01-13 14:45 ` jason at gcc dot gnu.org
2015-01-13 21:05 ` jason at gcc dot gnu.org
2015-01-15 20:46 ` jason 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).