public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet @ 2022-07-22 9:51 chumarshal at foxmail dot com 2022-07-22 11:55 ` [Bug c/106406] " rguenth at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: chumarshal at foxmail dot com @ 2022-07-22 9:51 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106406 Bug ID: 106406 Summary: _Static_assert declaration can not be first of for-triplet Product: gcc Version: rust/master Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: chumarshal at foxmail dot com Target Milestone: --- int main() { int i = 4; for (_Static_assert (3, "This is a three"); i < 7; i++) { i += 2; } } Gcc can build successfully, but it does not follow C spec: 6.8.5 Iteration statements (Constraints) The declaration part of a for statement shall only declare identifiers for objects having storage class auto or register. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/106406] _Static_assert declaration can not be first of for-triplet 2022-07-22 9:51 [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet chumarshal at foxmail dot com @ 2022-07-22 11:55 ` rguenth at gcc dot gnu.org 2022-07-25 19:27 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2022-07-22 11:55 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106406 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- it doesn't declare anything so why should it be invalid? ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/106406] _Static_assert declaration can not be first of for-triplet 2022-07-22 9:51 [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet chumarshal at foxmail dot com 2022-07-22 11:55 ` [Bug c/106406] " rguenth at gcc dot gnu.org @ 2022-07-25 19:27 ` pinskia at gcc dot gnu.org 2022-07-25 19:37 ` pinskia at gcc dot gnu.org 2022-09-05 3:28 ` chumarshal at foxmail dot com 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-07-25 19:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106406 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- clang rejects it while both ICC and MSVC accepts it as being valid. 6.7.10 Static assertions ... Semantics ... If the value of the constant expression compares unequal to 0, the declaration has no effect. --- There is no identifiers defined so the constraint of Iteration statements is not violated as far as I can tell. So I do think this is a clang bug so closing as invalid. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/106406] _Static_assert declaration can not be first of for-triplet 2022-07-22 9:51 [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet chumarshal at foxmail dot com 2022-07-22 11:55 ` [Bug c/106406] " rguenth at gcc dot gnu.org 2022-07-25 19:27 ` pinskia at gcc dot gnu.org @ 2022-07-25 19:37 ` pinskia at gcc dot gnu.org 2022-09-05 3:28 ` chumarshal at foxmail dot com 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2022-07-25 19:37 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106406 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- One thing I noticed with clang is that it is the rejected inside the parser rather than later on with the semantic analysis meaning I think it was overlooked for clang's parser. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/106406] _Static_assert declaration can not be first of for-triplet 2022-07-22 9:51 [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet chumarshal at foxmail dot com ` (2 preceding siblings ...) 2022-07-25 19:37 ` pinskia at gcc dot gnu.org @ 2022-09-05 3:28 ` chumarshal at foxmail dot com 3 siblings, 0 replies; 5+ messages in thread From: chumarshal at foxmail dot com @ 2022-09-05 3:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106406 --- Comment #4 from marshal <chumarshal at foxmail dot com> --- (In reply to marshal from comment #0) > int main() > { > int i = 4; > for (_Static_assert (3, "This is a three"); i < 7; i++) { > i += 2; > } > } > > > Gcc can build successfully, but it does not follow C spec: > > 6.8.5 Iteration statements > (Constraints) > The declaration part of a for statement shall only declare identifiers for > objects having storage class auto or register. /* * (c) Copyright 2016-2021 by Solid Sands B.V., * Amsterdam, the Netherlands. All rights reserved. * Subject to conditions in the RESTRICTIONS file. */ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-09-05 3:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-22 9:51 [Bug c/106406] New: _Static_assert declaration can not be first of for-triplet chumarshal at foxmail dot com 2022-07-22 11:55 ` [Bug c/106406] " rguenth at gcc dot gnu.org 2022-07-25 19:27 ` pinskia at gcc dot gnu.org 2022-07-25 19:37 ` pinskia at gcc dot gnu.org 2022-09-05 3:28 ` chumarshal at foxmail dot com
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).