Clang error: use of ... B requires template arguments (err_template_missing_args)
Jump to navigation
Jump to search
Text | error: use of class template A requires template arguments |
---|---|
Type | Error |
Category | Semantic Issue |
Internal Id | err_template_missing_args |
Internal Message | use of class template %0 requires template arguments
|
Regular Expression | (?:error|fatal error)\: use of (?:class template|function template|variable template|alias template|template template parameter|concept|template) (.*?) requires template arguments
|
First Commit | 2010-04-08 823015d627b8 When a template (without arguments) is passed as a template type |
Description
Example
Flags | -xc++ -std=c++11
|
|
---|---|---|
Source |
template<typename T> class A : T {}; A<A> a; // A used without template arguments
| |
Compiler Output |
<source>:1:40: error: use of class template 'A' requires template arguments <source>:1:28: note: template is declared here |
Clang Internals (17.0.6)
Git Commit Message
When a template (without arguments) is passed as a template type parameter, explicitly ask the user to give it arguments. We used to complain that it wasn't a type and expect the user to figure it out. llvm-svn: 100729
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaTemplate.cpp (line 4898)
void Sema::diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc) {
Diag(Loc, diag::err_template_missing_args) << (int)getTemplateNameKindForDiagnostics(Name) << Name;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Parser/cxx2a-constrained-template-param.cpp
- clang/test/Parser/cxx2a-constrained-template-param.cpp:49:27: error: use of class template 'test1' requires template arguments