public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition
@ 2015-07-27 14:24 anders.granlund.0 at gmail dot com
2015-07-27 22:49 ` [Bug c++/67026] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: anders.granlund.0 at gmail dot com @ 2015-07-27 14:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67026
Bug ID: 67026
Summary: GCC incorrectly rejects well-formed constexpr function
definition
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: anders.granlund.0 at gmail dot com
Target Milestone: ---
Consider the following program (proc.cc):
void g() {}
constexpr void f() { return; g(); }
int main() {}
Compile it with the following command line:
g++ prog.cc -std=c++14 -pedantic-errors
The following error message is given:
prog.cc: In function 'constexpr void f()':
prog.cc:2:31: error: call to non-constexpr function 'void g()'
constexpr void f() { return; g(); }
^
I expected to get no error message since the program is well-formed.
I have tried this with gcc HEAD 6.0.0 20150726 here:
http://melpon.org/wandbox/permlink/Hd5t7ppNQWFqioUx
For comparison clang accepts the program with no error messages.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67026] GCC incorrectly rejects well-formed constexpr function definition
2015-07-27 14:24 [Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition anders.granlund.0 at gmail dot com
@ 2015-07-27 22:49 ` pinskia at gcc dot gnu.org
2015-07-27 22:50 ` pinskia at gcc dot gnu.org
2015-08-29 15:54 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-27 22:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67026
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC does not implement the full C++14 rules for constexpr yet. That is having
a return type of void is not implemented yet. It was invalid for C++11 to have
a constexpr with void.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67026] GCC incorrectly rejects well-formed constexpr function definition
2015-07-27 14:24 [Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition anders.granlund.0 at gmail dot com
2015-07-27 22:49 ` [Bug c++/67026] " pinskia at gcc dot gnu.org
@ 2015-07-27 22:50 ` pinskia at gcc dot gnu.org
2015-08-29 15:54 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-07-27 22:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67026
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually wait. I think this is invalid and clang is incorrect in not rejecting
it. Because you have a call to a non constexpr in a constexpr function; does
not matter if it is after a return or not.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/67026] GCC incorrectly rejects well-formed constexpr function definition
2015-07-27 14:24 [Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition anders.granlund.0 at gmail dot com
2015-07-27 22:49 ` [Bug c++/67026] " pinskia at gcc dot gnu.org
2015-07-27 22:50 ` pinskia at gcc dot gnu.org
@ 2015-08-29 15:54 ` trippels at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-08-29 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67026
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-29
CC| |trippels at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
Confirmed.
Another example:
constexpr int f3() {
return 0;
throw;
}
Checking should stop after the return statement.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-08-29 15:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-27 14:24 [Bug c++/67026] New: GCC incorrectly rejects well-formed constexpr function definition anders.granlund.0 at gmail dot com
2015-07-27 22:49 ` [Bug c++/67026] " pinskia at gcc dot gnu.org
2015-07-27 22:50 ` pinskia at gcc dot gnu.org
2015-08-29 15:54 ` trippels 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).