Skip to content

Clang fails to resolve some names inside templates/lambdas under -fdelayed-template-parsing or --driver-mode=cl #94585

Open
@higher-performance

Description

@higher-performance

Repro:

struct Outer
{
	template<class = void>
	static void foo()
	{
		struct S
		{
		};
		auto const g = []()
		{
			struct H
			{
				static void f()
				{
					typedef S S;  // error: unknown type name 'S'
				}
			};
		};
	}
};

int main()
{
	Outer().foo();
}

Both Clang and MSVC compile this fine with eager template parsing, but clang-cl fails to compile it due to delayed template parsing.

This makes clang-cl incompatible with MSVC.

Note that MSVC always handles this fine, regardless of /permissive[-] or /Zc:twoPhase[-].

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-cl`clang-cl` driver. Don't use for other compiler partsclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions