File: p8-1y.cpp

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (36 lines) | stat: -rw-r--r-- 2,184 bytes parent folder | download | duplicates (29)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// RUN: %clang_cc1 -std=c++1y -fsyntax-only -verify %s

// -- The argument list of the specialization shall not be identical
//    to the implicit argument list of the primary template.

template<typename T, int N, template<typename> class X> int v1;
template<typename T, int N, template<typename> class X> int v1<T, N, X>;
// expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}

template<typename...T> int v2;
template<typename...T> int v2<T...>;
// expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}

template<int...N> int v3;
template<int...N> int v3<N...>;
// expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}

template<template<typename> class...X> int v4;
template<template<typename> class...X> int v4<X...>;
// expected-error@-1{{variable template partial specialization does not specialize any template argument; to define the primary template, remove the template argument list}}

template<typename Outer> struct X {
  template<typename Inner> static int y;
  // FIXME: It would be preferable to only diagnose this once.
  template<typename Inner> static int y<Outer>; // expected-error 3{{cannot be deduced}} expected-note 3{{'Inner'}}
  template<typename Inner> static int y<Inner>; // expected-error {{does not specialize}}

  template<typename, int> static int z;
  template<Outer N> static int z<int, N>; // expected-error {{not implicitly convertible}}
};
template<typename Outer> template<typename Inner> int X<Outer>::y<Outer>; // expected-error {{cannot be deduced}} expected-note {{'Inner'}}
template<typename Outer> template<typename Inner> int X<Outer>::y<Inner>; // expected-error {{does not specialize}}
template<> template<typename Inner> int X<int>::y<Inner>; // expected-error {{does not specialize}} expected-note {{instantiation of}}

X<int> xi;
X<int*> xf; // expected-note {{instantiation of}}