Skip to content

clang crash due to missing typename for dependent type #174301

@pfent

Description

@pfent

The following minimized reproducer produces a clang frontend crash:

template <class T>
struct Tester {
   struct Inner {
      using T2 = int;
   };
   static void test();
};

template <class T>
/*typename*/ Tester<T>::Inner::T2 getInnerT2() { return {}; }

template <class T>
void Tester<T>::test() {
   auto _ = getInnerT2<T>();
}

template struct Tester<int>;

https://compiler-explorer.com/z/jnqf8fP68

Assertion:

clang++: /root/llvm-project/llvm/tools/clang/lib/AST/ASTContext.cpp:2428:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const:
Assertion `!A->getDeducedType().isNull() && "cannot request the size of an undeduced or dependent auto type"' failed.

Note that this only crashes when omitting the typename from getInnerT2(). With explicit typename, the code compiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrash-on-validregression:16Regression in 16 release

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions