Skip to content

Wrong location for "not a member" error when constructing a struct literal #21215

@vpanteleev-sym

Description

@vpanteleev-sym
struct S { int x; }

void test() {
	auto s = S(
		y:
		1
	);
}

Output:

test.d(6): Error: `y` is not a member of `S`

The error is reported on the line with the value (1), but the undefined identifier in question is actually on the previous line.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions