File: pr36536.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 (44 lines) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (24)
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
37
38
39
40
41
42
43
44
// RUN: %clang_cc1 -std=c++11 %s -verify -fno-spell-checking

// These test cases are constructed to make clang call ActOnStartOfFunctionDef
// with nullptr.

struct ImplicitDefaultCtor1 {};
struct Foo {
  typedef int NameInClass;
  void f();
};
namespace bar {
// FIXME: Improved our recovery to make this a redeclaration of Foo::f,
// even though this is in the wrong namespace. That will allow name lookup to
// find NameInClass below. Users are likely to hit this when they forget to
// close namespaces.
// expected-error@+1 {{cannot define or redeclare 'f' here}}
void Foo::f() {
  switch (0) { case 0: ImplicitDefaultCtor1 o; }
  // expected-error@+1 {{unknown type name 'NameInClass'}}
  NameInClass var;
}
} // namespace bar

struct ImplicitDefaultCtor2 {};
template <typename T> class TFoo { void f(); };
// expected-error@+1 {{nested name specifier 'decltype(TFoo<T>())::'}}
template <typename T> void decltype(TFoo<T>())::f() {
  switch (0) { case 0: ImplicitDefaultCtor1 o; }
}

namespace tpl2 {
struct ImplicitDefaultCtor3 {};
template <class T1> class A {
  template <class T2> class B {
    void mf2();
  };
};
template <class Y>
template <>
// expected-error@+1 {{nested name specifier 'A<Y>::B<double>::'}}
void A<Y>::B<double>::mf2() {
  switch (0) { case 0: ImplicitDefaultCtor3 o; }
}
}