Initial tests for verifying forward declarations

(cherry picked from commit c9b5a07d5cd83100862e067ccff189e10c666f9b)
This commit is contained in:
manasij7479 2014-05-31 04:52:58 +05:30 committed by sftnight
parent cd3259b39a
commit 01a4bf5e5b
3 changed files with 59 additions and 0 deletions

21
test/Autoloading/Def.h Normal file
View File

@ -0,0 +1,21 @@
int id(int x) {
return x;
}
class C {
//irrelevant
};
namespace N {
void nested() {
}
}//end namespace N
template<typename T> class Gen {
};
template<> class Gen<int> {
};
template<typename T,typename U> class Partial {
};

View File

@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -I %S -Xclang -verify
// Test forwardDeclaration
.rawInput 1
int id(int) __attribute__((annotate("Def.h")));
class __attribute__((annotate("Def.h"))) C;
namespace N {
void nested() __attribute__((annotate("Def.h")));
}
template <typename T> class __attribute__((annotate("Def.h"))) Gen;
template <> class __attribute__((annotate("Def.h"))) Gen<int> ;
template <> class __attribute__((annotate("Spc.h"))) Gen<float>;
template <typename T,typename U> class __attribute__((annotate("Def.h"))) Partial;
template <typename T> class __attribute__((annotate("Spc.h"))) Partial<T,int>;
.rawInput 0
#include "Def.h"
#include "Spc.h"
//expected-no-diagnostics
.q

5
test/Autoloading/Spc.h Normal file
View File

@ -0,0 +1,5 @@
template<> class Gen<float> {
};
template<typename T> class Partial<T,int> {
};