Issue 174301
Summary clang crash due to missing typename for dependent type
Labels clang
Assignees
Reporter pfent
    The following minimized reproducer produces a clang frontend crash:

```cpp
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.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to