Add cling version of test for ROOT-7037

This commit is contained in:
Philippe Canal 2016-11-13 15:25:07 -06:00 committed by sftnight
parent ac05814edc
commit 6920d6d460
4 changed files with 36 additions and 0 deletions

View File

@ -9,6 +9,23 @@
// RUN: cat %s | %cling -I%S -Xclang -verify
// Test FwdPrinterTest
// Test similar to ROOT-7037
// Equivalent to parsing the dictionary preamble
.T Def2b.h fwd_Def2b.h
#include "fwd_Def2b.h"
// Then doing the autoparsing
#include "Def2b.h"
A<int> ai2;
// And then do both a second time with a different template instantiation.
.T Def2c.h fwd_Def2c.h
#include "fwd_Def2c.h"
#include "Def2c.h"
// In some implementations the AutoloadingVisitor was stripping the default
// template parameter value from the class template definition leading to
// compilation error at this next line:
A<float> af2;
.T Def2.h fwd_Def2.h
#include "fwd_Def2.h"
#include "Def2.h"

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

@ -0,0 +1,5 @@
#ifndef DEF2_A
#define DEF2_A
template<class T, class U=int>
class A{};
#endif

2
test/Autoloading/Def2b.h Normal file
View File

@ -0,0 +1,2 @@
#include "Def2a.h"
A<int> bc;

12
test/Autoloading/Def2c.h Normal file
View File

@ -0,0 +1,12 @@
// In the ROOT case, the duplicated default parameter definition is suppressed
// when it is due to two annotated forward decl (i.e. the $clingAutoload$ ones)
// Since in standalone cling this is not the case, let's 'emulate' that behavior
// by remove the default from the declaration.
//#include "Def2a.h"
#ifndef DEF2_A
template<class T, class U>
class A{};
#endif
A<float,int> ac;