Skip to content

_Static_assert declaration can not be first of for-triplet #56471

Closed
@chumarshal1

Description

@chumarshal1
/*
 * (c) Copyright 2016-2021 by Solid Sands B.V.,
 *     Amsterdam, the Netherlands. All rights reserved.
 *     Subject to conditions in the RESTRICTIONS file.
 */
int main()
{
    int i = 4;
    for (_Static_assert (3, "This is a three"); i < 7; i++) {
        i += 2;
    }
 }
clang test.c 
test.c:4:10: error: expected identifier or '('
    for (_Static_assert (3, "This is a three"); i < 7; i++) {
         ^
test.c:4:49: error: expected ';' in 'for' statement specifier
    for (_Static_assert (3, "This is a three"); i < 7; i++) {
                                                ^
2 errors generated.

But gcc can build successfully, is it clang issue?

Metadata

Metadata

Assignees

Labels

c23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions