-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
6 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
template<typename T> class A; // expected-note 2 {{template parameter is declared here}} | ||
template<typename T> class A; // expected-note 2 {{template parameter is declared here}} expected-note{{template is declared here}} | ||
|
||
// [temp.arg.type]p1 | ||
A<0> *a1; // expected-error{{template argument for template type parameter must be a type}} | ||
|
||
A<A> *a2; // expected-error{{template argument for template type parameter must be a type}} | ||
A<A> *a2; // expected-error{{use of class template A requires template arguments}} | ||
|
||
A<int> *a3; | ||
A<int()> *a4; | ||
A<int(float)> *a5; | ||
A<A<int> > *a6; | ||
|
||
// Pass an overloaded function template: | ||
template<typename T> void function_tpl(T); | ||
A<function_tpl> a7; // expected-error{{template argument for template type parameter must be a type}} | ||
|
||
// Pass a qualified name: | ||
namespace ns { | ||
template<typename T> class B {}; // expected-note{{template is declared here}} | ||
} | ||
A<ns::B> a8; // expected-error{{use of class template ns::B requires template arguments}} | ||
|
||
// [temp.arg.type]p2 | ||
void f() { | ||
class X { }; | ||
A<X> * a = 0; // expected-error{{template argument uses local type 'X'}} | ||
} | ||
|
||
struct { int x; } Unnamed; // expected-note{{unnamed type used in template argument was declared here}} | ||
A<__typeof__(Unnamed)> *a7; // expected-error{{template argument uses unnamed type}} | ||
A<__typeof__(Unnamed)> *a9; // expected-error{{template argument uses unnamed type}} | ||
|
||
// FIXME: [temp.arg.type]p3. The check doesn't really belong here (it | ||
// belongs somewhere in the template instantiation section). |