Commit 6d5f7866 authored by Steffen Müthing's avatar Steffen Müthing

[bugfix][gcc] Work around compiler bug in GCC 5

Using `staticDegree` in certain contexts triggers an ICE in GCC 5. This
patch works around the problem by introducing an intermediate constant
that holds the result in these cases.
parent 11811963
......@@ -59,22 +59,23 @@ namespace Dune {
{
typedef typename TransformedNodeTemplate<TC>::type type;
typedef std::shared_ptr<type> storage_type;
static const std::size_t degree = staticDegree<type>;
};
template<typename TC>
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::degree>& children)
{
return typename result<TC>::type(s,t,children);
}
template<typename TC>
static typename result<TC>::type transform(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
static typename result<TC>::type transform(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::degree>& children)
{
return typename result<TC>::type(s,t,children);
}
template<typename TC>
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::degree>& children)
{
return std::make_shared<typename result<TC>::type>(s,t,children);
}
......
......@@ -53,16 +53,17 @@ namespace Dune {
{
typedef TransformedNode<TC, staticDegree<SourceNode>> type;
typedef std::shared_ptr<type> storage_type;
static const std::size_t degree = staticDegree<type>;
};
template<typename TC>
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<typename result<TC>::type>>& children)
static typename result<TC>::type transform(const SourceNode& s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::degree>& children)
{
return typename result<TC>::type(children);
}
template<typename TC>
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,staticDegree<result<TC>::type>>& children)
static typename result<TC>::storage_type transform_storage(std::shared_ptr<const SourceNode> s, const Transformation& t, const std::array<std::shared_ptr<TC>,result<TC>::degree>& children)
{
return std::make_shared<typename result<TC>::type>(children);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment