https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77950

            Bug ID: 77950
           Summary: GCC produces un-demanglable symbols with [] (auto&) {
                    ... } lambdas in templates
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeanmichael.celerier at gmail dot com
  Target Milestone: ---

Created attachment 39793
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39793&action=edit
Preprocessed source exhibiting the bug

My problem is in the attachement starting at line 135809, within the struct
vec_merger_impl.

When I have this code : 

    template<int N>
    struct vec_merger_impl
    {
      template<typename Dataspace_T>
      ossia::value_with_unit operator()(const Dataspace_T& ds)
      {
        if(ds)
        {
          return eggs::variants::apply([&] (auto& unit) ->
ossia::value_with_unit {
            return detail::vec_value_merger<N>{idx}(unit, val);
          }, ds);
        }
        return {};
      }
    };

The lambda [&] (auto& unit) ... produces undemanglable code, which makes the
software undebuggable... doing "nm -a preprocessed.o | c++filt" fails at the
following symbol : 

_ZN4eggs8variants6detail7forwardIOZN5ossia15vec_merger_implILi2EEclINS0_7variantIJNS3_12strong_valueINS3_11speed_ratioISt5ratioILl1ELl1EEEEEENS8_INS9_ISA_ILl16093440ELl36000000EEEEEENS8_INS9_ISA_ILl1000ELl3600EEEEEENS8_INS9_ISA_ILl1852ELl3600EEEEEENS8_INS9_ISA_ILl3048ELl10000EEEEEENS8_INS9_ISA_ILl3048ELl36000000EEEEEEEEEEENS7_IJNS3_5valueENS7_IJNS8_INS3_14distance_ratioISB_EEEENS8_INSV_ISA_ILl1000ELl1EEEEEENS8_INSV_ISA_ILl1ELl10EEEEEENS8_INSV_ISA_ILl1ELl100EEEEEENS8_INSV_ISA_ILl1ELl1000EEEEEENS8_INSV_ISA_ILl1ELl1000000EEEEEENS8_INSV_ISA_ILl1ELl1000000000EEEEEENS8_INSV_ISA_ILl1ELl1000000000000EEEEEENS8_INSV_ISA_ILl254ELl10000EEEEEENS8_INSV_ISN_EEEENS8_INSV_ISA_ILl16093440ELl10000EEEEEEEEENS7_IJNS8_INS3_14cartesian_3d_uEEENS8_INS3_14cartesian_2d_uEEENS8_INS3_11spherical_uEEENS8_INS3_7polar_uEEENS8_INS3_8opengl_uEEENS8_INS3_13cylindrical_uEEEEEEST_NS7_IJNS8_INS3_12quaternion_uEEENS8_INS3_7euler_uEEENS8_INS3_6axis_uEEEEEENS7_IJNS8_INS3_8degree_uEEENS8_INS3_8radian_uEEEEEENS7_IJNS8_INS3_6argb_uEEENS8_INS3_6rgba_uEEENS8_INS3_5rgb_uEEENS8_INS3_5bgr_uEEENS8_INS3_7argb8_uEEENS8_INS3_5hsv_uEEENS8_INS3_6cmy8_uEEENS8_INS3_5xyz_uEEEEEENS7_IJNS8_INS3_8linear_uEEENS8_INS3_10midigain_uEEENS8_INS3_9decibel_uEEENS8_INS3_13decibel_raw_uEEEEEEEEERKT_EUlRS38_E_EEOS38_RNSt16remove_referenceIS38_E4typeE

If I change my lambda by an equivalent functor (can be tested in the attached
source by setting -DFIXED_VERSION, the code passes through c++filt (and GDB)
without problems.

Reply via email to