Skip to content

[clang][rejects-valid] not finding partial specialization of nested class template #130160

Closed
@ericniebler

Description

@ericniebler

the following valid code does not compile on any version of clang i have tested, including trunk:

template <class I>
struct Outer
{
  template <I X, I Y>
  struct Inner;
};

Outer<int> e2; // <== need to instantiate the outer template here

template <class I> 
template <I Y>
struct Outer<I>::Inner<0, Y> {};

constexpr Outer<int>::Inner<0, 4> e{}; // <== type incomplete here

the error is:

<source>:15:35: error: constexpr variable cannot have non-literal type 'const Outer<int>::Inner<0, 4>'
constexpr Outer<int>::Inner<0, 4> e{};
                                  ^
<source>:15:35: error: implicit instantiation of undefined template 'Outer<int>::Inner<0, 4>'
<source>:6:10: note: template is declared here
  struct Inner;
         ^
2 errors generated.
Compiler returned: 1

demo:
https://godbolt.org/z/8rvKqqWhM

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions