Skip to content

Where clause parsing does not gracefully exit in case of an invalid decl #1096

Open
@mgrang

Description

@mgrang

If we have code like this:

void f() {
  _Nt_array_ptr<char> p : count(0);
}

The compiler emits an error:

a.c:4: error: automatic variable 'p' with bounds must have initializer
  _Nt_array_ptr<char> p : count(0);

However, if a where clause is attached to this invalid decl:

void f() {
  _Nt_array_ptr<char> p : count(0) _Where 1 == 1;
}

The compiler runs into an infinite loop and emits a lot of these error messages:

a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
a.c:4:44: error: where clause on invalid decl
...

Metadata

Metadata

Assignees

Labels

bugThis labels issues that are bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions