boostorg / boostorg/mpl

MPL Overloads: template<> missing

Open
#45 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
65
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Compiling boost MPL with (NVCC 10.1.168 and) GCC 6.4.0 and `-Wall -Wextra` throws the following warnings. Mainly `-Wnon-template-friend` and `operatorXY ... declares a non-template function -- add <> to refer to a template instance`

Generally, the macros for overloads seem to lack `template <>` and similar annotations:

```
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(54): warning: "boost::mpl::aux::type_wrapper operator/(const boost::mpl::m_item &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(55): warning: "boost::mpl::aux::type_wrapper> operator|(const boost::mpl::m_item &, boost::mpl::next::type *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(56): warning: "char (&operator||(const boost::mpl::m_item &, boost::mpl::aux::type_wrapper *))[boost::mpl::next::type::value]" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(71): warning: "boost::mpl::aux::type_wrapper operator/(const boost::mpl::m_mask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(72): warning: "boost::mpl::aux::type_wrapper operator|(const boost::mpl::m_mask &, boost::mpl::x_order_impl::type *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(47): warning: "char (&operator||(const boost::mpl::s_item &, boost::mpl::aux::type_wrapper *))[boost::mpl::next::type::value]" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(48): warning: "boost::mpl::aux::no_tag operator%(const boost::mpl::s_item &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(63): warning: "boost::mpl::aux::yes_tag operator%(const boost::mpl::s_mask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(77): warning: "boost::mpl::aux::no_tag operator%(const boost::mpl::s_unmask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(54): warning: "boost::mpl::aux::type_wrapper operator/(const boost::mpl::m_item &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(55): warning: "boost::mpl::aux::type_wrapper> operator|(const boost::mpl::m_item &, boost::mpl::next::type *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(56): warning: "char (&operator||(const boost::mpl::m_item &, boost::mpl::aux::type_wrapper *))[boost::mpl::next::type::value]" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(71): warning: "boost::mpl::aux::type_wrapper operator/(const boost::mpl::m_mask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp(72): warning: "boost::mpl::aux::type_wrapper operator|(const boost::mpl::m_mask &, boost::mpl::x_order_impl::type *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(47): warning: "char (&operator||(const boost::mpl::s_item &, boost::mpl::aux::type_wrapper *))[boost::mpl::next::type::value]" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(48): warning: "boost::mpl::aux::no_tag operator%(const boost::mpl::s_item &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(63): warning: "boost::mpl::aux::yes_tag operator%(const boost::mpl::s_mask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp(77): warning: "boost::mpl::aux::no_tag operator%(const boost::mpl::s_unmask &, boost::mpl::aux::type_wrapper *)" declares a non-template function -- add <> to refer to a template instance

linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp: At global scope:
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:54:83: warning: friend declaration 'boost::mpl::aux::type_wrapper boost::mpl::operator/(const boost::mpl::m_item&, boost::mpl::aux::type_wrapper*)' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, VALUE_BY_KEY, m_item, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:54:83: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here)
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:55:77: warning: friend declaration 'boost::mpl::aux::type_wrapper > boost::mpl::operator|(const boost::mpl::m_item&, boost::mpl::m_item::order*)' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, ITEM_BY_ORDER, m_item, order* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:56:72: warning: friend declaration 'char (& boost::mpl::operator||(const boost::mpl::m_item&, boost::mpl::aux::type_wrapper*))[boost::mpl::m_item::order:: value]' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:71:93: warning: friend declaration 'boost::mpl::aux::type_wrapper boost::mpl::operator/(const boost::mpl::m_mask&, boost::mpl::aux::type_wrapper*)' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, VALUE_BY_KEY, m_mask, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/map/aux_/item.hpp:72:79: warning: friend declaration 'boost::mpl::aux::type_wrapper boost::mpl::operator|(const boost::mpl::m_mask&, boost::mpl::m_mask::key_order_*)' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper, ITEM_BY_ORDER, m_mask, key_order_* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp:47:70: warning: friend declaration 'char (& boost::mpl::operator||(const boost::mpl::s_item&, boost::mpl::aux::type_wrapper*))[boost::mpl::s_item::order:: value]' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_SET_OVERLOAD( order_tag_, ORDER_BY_KEY, s_item, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp:48:70: warning: friend declaration 'char (& boost::mpl::operator%(const boost::mpl::s_item&, boost::mpl::aux::type_wrapper*))[1]' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_item, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp:63:71: warning: friend declaration 'char (& boost::mpl::operator%(const boost::mpl::s_mask&, boost::mpl::aux::type_wrapper*))[2]' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_SET_OVERLOAD( aux::yes_tag, IS_MASKED, s_mask, aux::type_wrapper* );
^
linux-rhel7-ppc64le/gcc-6.4.0/boost-1.66.0-nxj2e2htxvm25phwnxtwbw3bajgcryko/include/boost/mpl/set/aux_/item.hpp:77:72: warning: friend declaration 'char (& boost::mpl::operator%(const boost::mpl::s_unmask&, boost::mpl::aux::type_wrapper*))[1]' declares a non-template function [-Wnon-template-friend]
BOOST_MPL_AUX_SET_OVERLOAD( aux::no_tag, IS_MASKED, s_unmask, aux::type_wrapper* );
```

Seen with [PIConGPU](https://github.com/ComputationalRadiationPhysics/picongpu/) `0.5.0-dev` as of https://github.com/ComputationalRadiationPhysics/picongpu/commit/1347ebb46d378d93bdf8f9c0ab7ceee0c9a2142a (and way before as well).

Small example with NVCC 10.1 that triggers this via the boost property tree:
https://cuda.godbolt.org/z/ir3p6i
```C++
#include

int main()
{
using boost::property_tree::ptree;
ptree pt;
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with boost/mpl/map/aux_/item.hpp and boost/mpl/set/aux_/item.hpp, focusing on the BOOST_MPL_AUX_MAP_OVERLOAD and BOOST_MPL_AUX_SET_OVERLOAD uses named in the warnings. Reproduce the warning with the linked NVCC/GCC setup or the small property-tree example, then verify that the reported non-template-friend warnings no longer appear.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.