summaryrefslogtreecommitdiffstats
path: root/test/CXX/temp/temp.decls
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/temp/temp.decls')
-rw-r--r--test/CXX/temp/temp.decls/p3.cpp7
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p1.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p2.cpp45
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p3.cpp13
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p3.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp7
6 files changed, 81 insertions, 1 deletions
diff --git a/test/CXX/temp/temp.decls/p3.cpp b/test/CXX/temp/temp.decls/p3.cpp
new file mode 100644
index 0000000..54800e4
--- /dev/null
+++ b/test/CXX/temp/temp.decls/p3.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> using A = int;
+template<typename T> using A<T*> = char; // expected-error {{partial specialization of alias templates is not permitted}}
+template<> using A<char> = char; // expected-error {{explicit specialization of alias templates is not permitted}}
+template using A<char> = char; // expected-error {{explicit instantiation of alias templates is not permitted}}
+using A<char> = char; // expected-error {{name defined in alias declaration must be an identifier}}
diff --git a/test/CXX/temp/temp.decls/temp.alias/p1.cpp b/test/CXX/temp/temp.decls/temp.alias/p1.cpp
new file mode 100644
index 0000000..80079b3
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.alias/p1.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> using U = T;
+
+// The name of the alias template is a template-name.
+U<char> x;
+void f(U<int>);
+typedef U<U<U<U<int>>>> I;
diff --git a/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/test/CXX/temp/temp.decls/temp.alias/p2.cpp
new file mode 100644
index 0000000..e145727
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.alias/p2.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+template<typename T> using U = T;
+
+using I = U<U<U<U<int>>>>;
+using I = int;
+
+template<typename A, typename B> using Fst = A;
+template<typename A, typename B> using Snd = B;
+
+using I = Fst<Snd<char,int>,double>;
+
+namespace StdExample {
+ // Prerequisites for example.
+ template<class T, class A> struct vector { /* ... */ };
+
+
+ template<class T> struct Alloc {};
+ template<class T> using Vec = vector<T, Alloc<T>>;
+ Vec<int> v;
+
+ template<class T>
+ void process(Vec<T>& v) // expected-note {{previous definition is here}}
+ { /* ... */ }
+
+ template<class T>
+ void process(vector<T, Alloc<T>>& w) // expected-error {{redefinition of 'process'}}
+ { /* ... */ }
+
+ template<template<class> class TT>
+ void f(TT<int>); // expected-note {{candidate template ignored}}
+
+ template<template<class,class> class TT>
+ void g(TT<int, Alloc<int>>);
+
+ int h() {
+ f(v); // expected-error {{no matching function for call to 'f'}}
+ g(v); // OK: TT = vector
+ }
+
+
+ // v's type is same as vector<int, Alloc<int>>.
+ using VTest = vector<int, Alloc<int>>;
+ using VTest = decltype(v);
+}
diff --git a/test/CXX/temp/temp.decls/temp.alias/p3.cpp b/test/CXX/temp/temp.decls/temp.alias/p3.cpp
new file mode 100644
index 0000000..2e9e55c
--- /dev/null
+++ b/test/CXX/temp/temp.decls/temp.alias/p3.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+
+// The example given in the standard (this is rejected for other reasons anyway).
+template<class T> struct A;
+template<class T> using B = typename A<T>::U; // expected-error {{no type named 'U' in 'A<T>'}}
+template<class T> struct A {
+ typedef B<T> U; // expected-note {{in instantiation of template type alias 'B' requested here}}
+};
+B<short> b;
+
+template<typename T> using U = int;
+// FIXME: This is illegal, but probably only because CWG1044 missed this paragraph.
+template<typename T> using U = U<T>;
diff --git a/test/CXX/temp/temp.decls/temp.friend/p3.cpp b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
index d116e01..0b2a25e 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p3.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p3.cpp
@@ -8,5 +8,5 @@ class B {
template <class T> friend class A;
template <class T> friend class Undeclared;
- template <class T> friend typename A<T>::Member; // expected-warning {{non-class type 'typename A<T>::Member' cannot be a friend}}
+ template <class T> friend typename A<T>::Member; // expected-error {{friend type templates must use an elaborated type}}
};
diff --git a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
index 62cf429..7375f98 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
@@ -37,3 +37,10 @@ int f3(Args ...args) {
}
template int f3(const char*, int, float, double);
+
+template<typename ...Args>
+int PR9953(Args ...args) {
+ return ^(Args *...block_args) {
+ return f1(block_args); // expected-error{{expression contains unexpanded parameter pack 'block_args'}}
+ }(&args...);
+}
OpenPOWER on IntegriCloud