Clang crashes on out-of-line template member function definition in a wrong namespace
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
# Clang crashes on out-of-line template member function definition in a wrong namespace
Compiler Explorer: https://gcc.godbolt.org/z/neT94c34f
## Reproducer
```c++
struct C { template void f(); };
namespace N { template void C::f() { struct S { T* p; ~S() { delete p; } }; } }
```
First reproduces on clang 5.0.0; still reproduces on trunk.
## Assertion (from an assertion-enabled build)
```
clang++: /root/build/tools/clang/include/clang/AST/TypeNodes.inc:82:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type*) const:
Assertion `!T->isDependentType() && "should not see dependent types here"' failed.
```
## Backtrace (clang trunk)
```
#4 clang::ASTContext::getTypeInfoImpl(clang::Type const*) const
#5 clang::ASTContext::getTypeInfo(clang::Type const*) const
#6 clang::ASTContext::getTypeAlignIfKnown(clang::QualType, bool) const
#7 hasNewExtendedAlignment(clang::Sema&, clang::QualType)
#8 clang::Sema::ActOnCXXDelete(...)
#9 clang::Parser::ParseCXXDeleteExpression(...)
...
#19 clang::Parser::ParseLexedMethodDef
#20 clang::Parser::ParseLexedMethodDefs
#21 clang::Parser::ParseCXXMemberSpecification
```
Contributor guide
Assessment
This issue has not been assessed yet.