minix/external/bsd/llvm/dist/clang/test/Parser/DelayedTemplateParsing.cpp
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

123 lines
2.1 KiB
C++

// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify -std=c++11 %s
template <class T>
class A {
void foo() {
undeclared();
}
void foo2();
};
template <class T>
class B {
void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}}
void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}}
void foo5() { } // expected-note {{previous definition is here}}
friend void foo3() {
undeclared();
}
};
template <class T>
void B<T>::foo5() { // expected-error {{redefinition of 'foo5'}}
}
template <class T>
void A<T>::foo2() {
undeclared();
}
template <class T>
void foo3() {
undeclared();
}
template void A<int>::foo2();
void undeclared()
{
}
template <class T> void foo5() {} //expected-note {{previous definition is here}}
template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}}
namespace Inner_Outer_same_template_param_name {
template <class T>
class Outmost {
public:
template <class T>
class Inner {
public:
void f() {
T* var;
}
};
};
}
namespace PR11931 {
template <typename RunType>
struct BindState;
template<>
struct BindState<void(void*)> {
static void Run() { }
};
class Callback {
public:
typedef void RunType();
template <typename RunType>
Callback(BindState<RunType> bind_state) {
BindState<RunType>::Run();
}
};
Callback Bind() {
return Callback(BindState<void(void*)>());
}
}
namespace rdar11700604 {
template<typename T> void foo() = delete;
struct X {
X() = default;
template<typename T> void foo() = delete;
};
}
namespace PR17334 {
template <typename = void> struct ArrayRef {
constexpr ArrayRef() {}
};
template <typename = void> void CreateConstInBoundsGEP2_32() {
ArrayRef<> IdxList;
}
void LLVMBuildStructGEP() { CreateConstInBoundsGEP2_32(); }
}
namespace PR17661 {
template <typename T>
constexpr T Fun(T A) { return T(0); }
constexpr int Var = Fun(20);
}