[cfe-commits] r73288 - in /cfe/trunk/test: CXX/temp/temp.param/p1.cpp CXX/temp/temp.param/p10.cpp CXX/temp/temp.param/p11.cpp CXX/temp/temp.param/p12.cpp CXX/temp/temp.param/p13.cpp CXX/temp/temp.param/p14.cpp CXX/temp/temp.param/p15-cxx0x.cpp CXX/temp/temp.param/p15.cpp CXX/temp/temp.param/p2.cpp CXX/temp/temp.param/p3.cpp CXX/temp/temp.param/p4.cpp CXX/temp/temp.param/p7.cpp CXX/temp/temp.param/p8.cpp SemaTemplate/right-angle-brackets-0x.cpp SemaTemplate/right-angle-brackets-98.cpp SemaTemplate/temp_param.cpp
Douglas Gregor
dgregor at apple.com
Fri Jun 12 23:59:08 PDT 2009
Author: dgregor
Date: Sat Jun 13 01:59:07 2009
New Revision: 73288
URL: http://llvm.org/viewvc/llvm-project?rev=73288&view=rev
Log:
Move a bunch of tests into temp.param, and write a few tests for paragraphs that hadn't been touched before
Added:
cfe/trunk/test/CXX/temp/temp.param/p1.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p10.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p11.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p12.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p13.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p14.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p15-cxx0x.cpp
- copied unchanged from r73285, cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp
cfe/trunk/test/CXX/temp/temp.param/p15.cpp
- copied unchanged from r73285, cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp
cfe/trunk/test/CXX/temp/temp.param/p2.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p3.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p4.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p7.cpp (with props)
cfe/trunk/test/CXX/temp/temp.param/p8.cpp (with props)
Removed:
cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp
cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp
cfe/trunk/test/SemaTemplate/temp_param.cpp
Added: cfe/trunk/test/CXX/temp/temp.param/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p1.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p1.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p1.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1 @@
+// Paragraph 1 is descriptive, and therefore requires no tests.
Propchange: cfe/trunk/test/CXX/temp/temp.param/p1.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p1.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p1.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p10.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p10.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p10.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p10.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,12 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename> struct Y1;
+template<typename, int> struct Y2;
+
+template<class T1, class T2 = int> class B2;
+template<class T1 = int, class T2> class B2;
+
+template<template<class, int> class, template<class> class = Y1> class B2t;
+template<template<class, int> class = Y2, template<class> class> class B2t;
+
+template<int N, int M = 5> class B2n;
+template<int N = 5, int M> class B2n;
Propchange: cfe/trunk/test/CXX/temp/temp.param/p10.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p10.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p10.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p11.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p11.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p11.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename> struct Y1;
+template<typename, int> struct Y2;
+
+template<class T1 = int, // expected-note{{previous default template argument defined here}}
+ class T2> // expected-error{{template parameter missing a default argument}}
+ class B1;
+
+template<template<class> class = Y1, // expected-note{{previous default template argument defined here}}
+ template<class> class> // expected-error{{template parameter missing a default argument}}
+ class B1t;
+
+template<int N = 5, // expected-note{{previous default template argument defined here}}
+ int M> // expected-error{{template parameter missing a default argument}}
+ class B1n;
Propchange: cfe/trunk/test/CXX/temp/temp.param/p11.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p11.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p11.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p12.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p12.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p12.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p12.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,37 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<typename> struct Y1; // expected-note{{too few template parameters in template template argument}}
+template<typename, int> struct Y2;
+
+// C++ [temp.param]p12:
+template<class T1,
+ class T2 = int> // expected-note{{previous default template argument defined here}}
+ class B3;
+template<class T1, typename T2> class B3;
+template<class T1,
+ typename T2 = float> // expected-error{{template parameter redefines default argument}}
+ class B3;
+
+template<template<class, int> class,
+ template<class> class = Y1> // expected-note{{previous default template argument defined here}}
+ class B3t;
+
+template<template<class, int> class, template<class> class> class B3t;
+
+template<template<class, int> class,
+ template<class> class = Y1> // expected-error{{template parameter redefines default argument}}
+ class B3t;
+
+template<int N,
+ int M = 5> // expected-note{{previous default template argument defined here}}
+ class B3n;
+
+template<int N, int M> class B3n;
+
+template<int N,
+ int M = 7> // expected-error{{template parameter redefines default argument}}
+ class B3n;
+
+// Check validity of default arguments
+template<template<class, int> class // expected-note{{previous template template parameter is here}}
+ = Y1> // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
+ class C1;
Propchange: cfe/trunk/test/CXX/temp/temp.param/p12.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p12.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p12.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p13.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p13.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p13.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p13.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,14 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// The scope of atemplate-parameterextends from its point of
+// declaration until the end of its template. In particular, a
+// template-parameter can be used in the declaration of subsequent
+// template-parameters and their default arguments.
+
+template<class T, T* p, class U = T> class X { /* ... */ };
+// FIXME: template<class T> void f(T* p = new T);
+
+// Check for bogus template parameter shadow warning.
+template<template<class T> class,
+ template<class T> class>
+ class B1noshadow;
Propchange: cfe/trunk/test/CXX/temp/temp.param/p13.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p13.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p13.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p14.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p14.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p14.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p14.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,5 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+// XFAIL
+
+// A template-parameter shall not be used in its own default argument.
+template<typename T = typename T::type> struct X; // expected-error{{default}}
Propchange: cfe/trunk/test/CXX/temp/temp.param/p14.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p14.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p14.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p2.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p2.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p2.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,16 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// There is no semantic difference between class and typename in a
+// template-parameter. typename followed by an unqualified-id names a
+// template type parameter.
+template<class T> struct X;
+template<typename T> struct X;
+
+// typename followed by aqualified-id denotes the type in a non-type
+// parameter-declaration.
+// FIXME: template<typename T, typename T::type Value> struct Y;
+
+// A storage class shall not be specified in a template-parameter declaration.
+template<static int Value> struct Z; // FIXME: expect an error
+
+// FIXME: add the example from p2
Propchange: cfe/trunk/test/CXX/temp/temp.param/p2.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p2.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p2.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p3.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p3.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p3.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,28 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// A type-parameter defines its identifier to be a type-name (if
+// declared with class or typename) or template-name (if declared with
+// template) in the scope of the template declaration.
+template<typename T> struct X0 {
+ T* value;
+};
+
+template<template<class T> class Y> struct X1 {
+ Y<int> value;
+};
+
+// [Note: because of the name lookup rules, a template-parameter that
+// could be interpreted as either a non-type template-parameter or a
+// type-parameter (because its identifier is the name of an already
+// existing class) is taken as a type-parameter. For example,
+class T { /* ... */ };
+int i;
+
+template<class T, T i> struct X2 {
+ void f(T t)
+ {
+ T t1 = i; //template-parameters T and i
+ ::T t2 = ::i; // global namespace members T and i \
+ // expected-error{{cannot initialize}}
+ }
+};
Propchange: cfe/trunk/test/CXX/temp/temp.param/p3.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p3.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p3.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p4.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p4.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p4.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,20 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+class X;
+
+// C++ [temp.param]p4
+typedef int INT;
+enum E { enum1, enum2 };
+template<int N> struct A1;
+template<INT N, INT M> struct A2;
+template<enum E x, E y> struct A3;
+template<int &X> struct A4;
+template<int *Ptr> struct A5;
+template<int (&f)(int, int)> struct A6;
+template<int (*fp)(float, double)> struct A7;
+template<int X::*pm> struct A8;
+template<float (X::*pmf)(float, int)> struct A9;
+template<typename T, T x> struct A10;
+
+template<float f> struct A11; // expected-error{{a non-type template parameter cannot have type 'float'}}
+
+template<void *Ptr> struct A12; // expected-error{{a non-type template parameter cannot have type 'void *'}}
Propchange: cfe/trunk/test/CXX/temp/temp.param/p4.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p4.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p4.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p7.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p7.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p7.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p7.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,15 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// A non-type template-parameter shall not be declared to have
+// floating point, class, or void type.
+struct A;
+
+template<double d> class X; // expected-error{{cannot have type}}
+template<double* pd> class Y; //OK
+template<double& rd> class Z; //OK
+
+template<A a> class X0; // expected-error{{cannot have type}}
+
+typedef void VOID;
+template<VOID a> class X01; // expected-error{{cannot have type}}
+
Propchange: cfe/trunk/test/CXX/temp/temp.param/p7.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p7.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p7.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/CXX/temp/temp.param/p8.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.param/p8.cpp?rev=73288&view=auto
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.param/p8.cpp (added)
+++ cfe/trunk/test/CXX/temp/temp.param/p8.cpp Sat Jun 13 01:59:07 2009
@@ -0,0 +1,6 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+template<int X[10]> struct A;
+template<int *X> struct A;
+template<int f(float, double)> struct B;
+typedef float FLOAT;
+template<int (*f)(FLOAT, double)> struct B;
Propchange: cfe/trunk/test/CXX/temp/temp.param/p8.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/CXX/temp/temp.param/p8.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/CXX/temp/temp.param/p8.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Removed: cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp?rev=73287&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp (original)
+++ cfe/trunk/test/SemaTemplate/right-angle-brackets-0x.cpp (removed)
@@ -1,22 +0,0 @@
-// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
-template<typename T> struct X;
-template<int I> struct Y;
-
-X<X<int>> *x1;
-
-Y<(1 >> 2)> *y1;
-Y<1 >> 2> *y2; // FIXME: expected-error{{expected unqualified-id}}
-
-X<X<X<X<X<int>>>>> *x2;
-
-template<> struct X<int> { };
-typedef X<int> X_int;
-struct Z : X_int { };
-
-void f(const X<int> x) {
- (void)reinterpret_cast<X<int>>(x); // expected-error{{reinterpret_cast from}}
- (void)reinterpret_cast<X<X<X<int>>>>(x); // expected-error{{reinterpret_cast from}}
-
- X<X<int>> *x1;
-}
-
Removed: cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp?rev=73287&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp (original)
+++ cfe/trunk/test/SemaTemplate/right-angle-brackets-98.cpp (removed)
@@ -1,12 +0,0 @@
-// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s
-template<typename T> struct X;
-template<int I> struct Y;
-
-X<X<int> > *x1;
-X<X<int>> *x2; // expected-error{{a space is required between consecutive right angle brackets (use '> >')}}
-
-X<X<X<X<int>> // expected-error{{a space is required between consecutive right angle brackets (use '> >')}}
- >> *x3; // expected-error{{a space is required between consecutive right angle brackets (use '> >')}}
-
-Y<(1 >> 2)> *y1;
-Y<1 >> 2> *y2; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}}
Removed: cfe/trunk/test/SemaTemplate/temp_param.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_param.cpp?rev=73287&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_param.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_param.cpp (removed)
@@ -1,90 +0,0 @@
-// RUN: clang-cc -fsyntax-only -verify %s
-
-class X;
-
-// C++ [temp.param]p4
-typedef int INT;
-enum E { enum1, enum2 };
-template<int N> struct A1;
-template<INT N, INT M> struct A2;
-template<enum E x, E y> struct A3;
-template<int &X> struct A4;
-template<int *Ptr> struct A5;
-template<int (&f)(int, int)> struct A6;
-template<int (*fp)(float, double)> struct A7;
-template<int X::*pm> struct A8;
-template<float (X::*pmf)(float, int)> struct A9;
-template<typename T, T x> struct A10;
-
-template<float f> struct A11; // expected-error{{a non-type template parameter cannot have type 'float'}}
-
-template<void *Ptr> struct A12; // expected-error{{a non-type template parameter cannot have type 'void *'}}
-
-// C++ [temp.param]p8
-template<int X[10]> struct A5;
-template<int f(float, double)> struct A7;
-
-// C++ [temp.param]p11:
-template<typename> struct Y1; // expected-note{{too few template parameters in template template argument}}
-template<typename, int> struct Y2;
-
-template<class T1 = int, // expected-note{{previous default template argument defined here}}
- class T2> // expected-error{{template parameter missing a default argument}}
- class B1;
-
-template<template<class> class = Y1, // expected-note{{previous default template argument defined here}}
- template<class> class> // expected-error{{template parameter missing a default argument}}
- class B1t;
-
-template<int N = 5, // expected-note{{previous default template argument defined here}}
- int M> // expected-error{{template parameter missing a default argument}}
- class B1n;
-
-// Check for bogus template parameter shadow warning.
-template<template<class T> class,
- template<class T> class>
- class B1noshadow;
-
-// C++ [temp.param]p10:
-template<class T1, class T2 = int> class B2;
-template<class T1 = int, class T2> class B2;
-
-template<template<class, int> class, template<class> class = Y1> class B2t;
-template<template<class, int> class = Y2, template<class> class> class B2t;
-
-template<int N, int M = 5> class B2n;
-template<int N = 5, int M> class B2n;
-
-// C++ [temp.param]p12:
-template<class T1,
- class T2 = int> // expected-note{{previous default template argument defined here}}
- class B3;
-template<class T1, typename T2> class B3;
-template<class T1,
- typename T2 = float> // expected-error{{template parameter redefines default argument}}
- class B3;
-
-template<template<class, int> class,
- template<class> class = Y1> // expected-note{{previous default template argument defined here}}
- class B3t;
-
-template<template<class, int> class, template<class> class> class B3t;
-
-template<template<class, int> class,
- template<class> class = Y1> // expected-error{{template parameter redefines default argument}}
- class B3t;
-
-template<int N,
- int M = 5> // expected-note{{previous default template argument defined here}}
- class B3n;
-
-template<int N, int M> class B3n;
-
-template<int N,
- int M = 7> // expected-error{{template parameter redefines default argument}}
- class B3n;
-
-// Check validity of default arguments
-template<template<class, int> class // expected-note{{previous template template parameter is here}}
- = Y1> // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
- class C1;
More information about the cfe-commits
mailing list