File: invalid-template-params.cpp

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (23 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s

template<class> class Foo {
  template<class UBar // expected-error {{expected ';' after class}}
                      // expected-note@-1 {{'UBar' declared here}}
                      // expected-note@-2 {{forward declaration of 'UBar'}}
  void foo1(); // expected-error {{non-type template parameter has incomplete type 'class UBar'}}
               // expected-error@-1 {{expected ',' or '>' in template-parameter-list}}
               // expected-error@-2 {{declaration does not declare anything}}
};

Foo<int>::UBar g1; // expected-error {{no type named 'UBar' in 'Foo<int>'}}

class C0 {
public:
  template<typename T0, typename T1 = T0 // missing closing angle bracket
  struct S0 {}; // expected-error {{'S0' cannot be defined in a type specifier}}
                // expected-error@-1 {{expected ',' or '>' in template-parameter-list}}
                // expected-error@-2 {{declaration does not declare anything}}
  C0() : m(new S0<int>) {} // expected-error {{expected '(' for function-style cast or type construction}}
                           // expected-error@-1 {{expected expression}}
  S0<int> *m; // expected-error {{expected member name or ';' after declaration specifiers}}
};