brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · a923d79 Raw
45 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -verify -fno-spell-checking2 3// These test cases are constructed to make clang call ActOnStartOfFunctionDef4// with nullptr.5 6struct ImplicitDefaultCtor1 {};7struct Foo {8  typedef int NameInClass;9  void f();10};11namespace bar {12// FIXME: Improved our recovery to make this a redeclaration of Foo::f,13// even though this is in the wrong namespace. That will allow name lookup to14// find NameInClass below. Users are likely to hit this when they forget to15// close namespaces.16// expected-error@+1 {{cannot define or redeclare 'f' here}}17void Foo::f() {18  switch (0) { case 0: ImplicitDefaultCtor1 o; }19  // expected-error@+1 {{unknown type name 'NameInClass'}}20  NameInClass var;21}22} // namespace bar23 24struct ImplicitDefaultCtor2 {};25template <typename T> class TFoo { void f(); };26// expected-error@+1 {{nested name specifier 'decltype(TFoo<T>())'}}27template <typename T> void decltype(TFoo<T>())::f() {28  switch (0) { case 0: ImplicitDefaultCtor1 o; }29}30 31namespace tpl2 {32struct ImplicitDefaultCtor3 {};33template <class T1> class A {34  template <class T2> class B {35    void mf2();36  };37};38template <class Y>39template <>40// expected-error@+1 {{nested name specifier 'A<Y>::B<double>'}}41void A<Y>::B<double>::mf2() {42  switch (0) { case 0: ImplicitDefaultCtor3 o; }43}44}45