Permalink
Browse files

Fixed the generated C# for a subclass of a specialisation of an unsup…

…ported template.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
  • Loading branch information...
ddobrev committed Aug 8, 2017
1 parent ee174c1 commit e7a34904ddfa1b3eb88a412a7cced2f099437339
@@ -51,18 +51,7 @@ select a.Type.Type.Desugar())
}
}
else
foreach (var @base in @class.Bases.Where(b => b.IsClass))
{
var specialization = @base.Class as ClassTemplateSpecialization;
if (specialization != null)
{
specializations.Add(specialization);
foreach (var field in specialization.Fields)
field.Visit(this);
foreach (var method in specialization.Methods)
method.Visit(this);
}
}
CheckBasesForSpecialization(@class);
return true;
}
@@ -191,6 +180,23 @@ where @base.IsClass
CheckLayoutFields(@base);
}
private void CheckBasesForSpecialization(Class @class)
{
foreach (var @base in @class.Bases.Where(b => b.IsClass))
{
var specialization = @base.Class as ClassTemplateSpecialization;
if (specialization != null)
{
specializations.Add(specialization);
foreach (var field in specialization.Fields)
field.Visit(this);
foreach (var method in specialization.Methods)
method.Visit(this);
}
CheckBasesForSpecialization(@base.Class);
}
}
private HashSet<ClassTemplateSpecialization> specializations = new HashSet<ClassTemplateSpecialization>();
private HashSet<ClassTemplateSpecialization> internalSpecializations = new HashSet<ClassTemplateSpecialization>();
private HashSet<Class> templates = new HashSet<Class>();
@@ -67,6 +67,9 @@ public void TestUncompilableCode()
{
int i = typeMappedWithOperator | 5;
}
using (Base<int> @base = new DerivedFromSpecializationOfUnsupportedTemplate())
{
}
#pragma warning restore 0168
#pragma warning restore 0219
@@ -18,6 +18,14 @@ int T1::getField() const
return field;
}
DerivedFromSpecializationOfUnsupportedTemplate::DerivedFromSpecializationOfUnsupportedTemplate()
{
}
DerivedFromSpecializationOfUnsupportedTemplate::~DerivedFromSpecializationOfUnsupportedTemplate()
{
}
HasDefaultTemplateArgument<bool, bool>::HasDefaultTemplateArgument()
{
}
@@ -105,7 +105,12 @@ class DLL_API DependentValueFieldForArray
};
template <typename T>
class DLL_API DependentValueFields
class DLL_API Base
{
};
template <typename T>
class DLL_API DependentValueFields : public Base<T>
{
public:
class Nested
@@ -167,6 +172,13 @@ DependentValueFields<T> DependentValueFields<T>::operator+(const DependentValueF
return sum;
}
class DLL_API DerivedFromSpecializationOfUnsupportedTemplate : public DependentValueFields<int>
{
public:
DerivedFromSpecializationOfUnsupportedTemplate();
~DerivedFromSpecializationOfUnsupportedTemplate();
};
template <typename T>
class DLL_API DependentPointerFields
{
@@ -411,6 +423,7 @@ template class DLL_API IndependentFields<int>;
template class DLL_API IndependentFields<bool>;
template class DLL_API IndependentFields<T1>;
template class DLL_API IndependentFields<std::string>;
template class DLL_API Base<int>;
template class DLL_API DependentValueFields<int>;
template class DLL_API VirtualTemplate<int>;
template class DLL_API VirtualTemplate<bool>;

0 comments on commit e7a3490

Please sign in to comment.