Skip to content

decltypeing static data member template of class template specified with auto won't be resolved #160497

@yaito3014

Description

@yaito3014

Following valid C++ code won't compile:

template<class> struct S { template<class> inline static auto mem = 42; }; using T = decltype(S<void>::mem<void>); T y = 42; int main() {}

Compiling with:

clang++-22 -std=c++17 source.cpp 

Errors are as follows:

source.cpp:9:3: error: cannot initialize a variable of type 'T' (aka 'auto') with an rvalue of type 'int' 9 | T y = 42; | ^ ~~ 1 error generated. 

This may be related to #56652, since it appears that the Clang frontend does not resolve the auto type, leaving code generation to handle an undeduced type.

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions