Project

General

Profile

Support #16107

Support #16096: Fix problems found when attempting to build with gcc 6.3.0

problem compiling lardata/Utilities/NestedIterator.h with gcc 6.3.0

Added by Lynn Garren over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Library
Target version:
-
Start date:
04/05/2017
Due date:
% Done:

100%

Estimated time:
Spent time:
Experiment:
LArSoft
Co-Assignees:
Duration:

Description

The following block in lardata/Utilities/NestedIterator.h fails under gcc 6.3.0:

  namespace details {
    namespace type_traits {

      //------------------------------------------------------------------------
      // helpers for has_const_iterator() function
      template <typename T, bool>
      struct has_const_iterator_struct: public std::false_type {};

      template <typename T>
      struct has_const_iterator_struct<T, true>: public std::true_type {};

      // Culled by SFINAE if T::const_iterator does not exist
      // or is not accessible or not default-constructable
      template <typename T>
      constexpr auto has_const_iterator_helper(T* = nullptr)
        -> decltype(typename T::const_iterator(), bool()) 
        { return true; }

      // Used as fallback when SFINAE culls the template method
      constexpr bool has_const_iterator_helper(...) { return false; }
      //------------------------------------------------------------------------

    } // namespace type_traits
  } // namespace details

The error message:

[ 61%] Building CXX object lardata/test/Utilities/CMakeFiles/NestedIterator_test.dir/NestedIterator_test.cc.o
In file included from /home/garren/scratch/larsoft/dev/srcs/lardata/test/Utilities/NestedIterator_test.cc:35:0:
/home/garren/scratch/larsoft/dev/srcs/lardata/lardata/Utilities/NestedIterator.h:108:22: error: redeclaration of ‘template<class T> constexpr decltype ((typename T::const_iterator(), bool())) lar::details::type_traits::has_const_iterator_helper(T*)’ may not have default arguments [-fpermissive]
       constexpr auto has_const_iterator_helper(T* = nullptr)
                      ^~~~~~~~~~~~~~~~~~~~~~~~~

Associated revisions

History

#1 Updated by Gianluca Petrillo over 3 years ago

  • Category set to Other
  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

As suggested by the compiler, removed the default value from the definition.
Commit lardata:1f987439b8f203a9e7e00d34baab1591ea4308cd .

#2 Updated by Gianluca Petrillo over 3 years ago

  • Category changed from Other to Library

#3 Updated by Lynn Garren about 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF