[llvm-bugs] [Bug 41759] New: warn_no_constructor_for_refconst can not be disabled (Boost.ConceptCheck)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 5 16:16:50 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41759

            Bug ID: 41759
           Summary: warn_no_constructor_for_refconst can not be disabled
                    (Boost.ConceptCheck)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mateusz at loskot.net
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The warn_no_constructor_for_refconst (and possibly other from close category)
can not be disabled as there is no corresponding `-Wno` flag available  in
clang++<=9.

This causes issues while compiling code that makes use of Boost.ConceptCheck
library. For example:


```
#include <boost/concept_check.hpp>
int main()
{
    using T = int const&;
    boost::function_requires
        <
            boost::EqualityComparableConcept<T>
        >();
}

```

will trigger a flood of warnings:


```
$ clang++ -std=c++11 -I/mnt/d/boost.wsl
clang_warn_no_constructor_for_refconst.cpp
In file included from clang_warn_no_constructor_for_refconst.cpp:1:
/mnt/d/boost.wsl/boost/concept_check.hpp:231:17: warning: struct
'EqualityComparable<const int &>' does not declare any constructor
      to initialize its non-modifiable members
  BOOST_concept(EqualityComparable,(TT))
                ^
/mnt/d/boost.wsl/boost/concept_check.hpp:231:17: note: in instantiation of
template class 'boost::EqualityComparable<const int &>'
      requested here
/mnt/d/boost.wsl/boost/concept/detail/has_constraints.hpp:32:63: note: in
instantiation of template class
      'boost::EqualityComparableConcept<const int &>' requested here
  inline yes has_constraints_(Model*,
wrap_constraints<Model,&Model::constraints>* = 0);
                                                              ^
/mnt/d/boost.wsl/boost/concept/detail/has_constraints.hpp:44:25: note: while
substituting deduced template arguments into function
      template 'has_constraints_' [with Model =
boost::EqualityComparableConcept<const int &>]
      , value = sizeof( detail::has_constraints_((Model*)0) ) ==
sizeof(detail::yes) );
                        ^
/mnt/d/boost.wsl/boost/concept/detail/general.hpp:53:19: note: in instantiation
of template class
      'boost::concepts::not_satisfied<boost::EqualityComparableConcept<const
int &> >' requested here
        concepts::not_satisfied<Model>::value
                  ^
/mnt/d/boost.wsl/boost/concept_check.hpp:50:7: note: in instantiation of
template class 'boost::concepts::requirement_<void
      (*)(boost::EqualityComparableConcept<const int &>)>' requested here
      BOOST_CONCEPT_ASSERT((Model));
      ^
/mnt/d/boost.wsl/boost/concept/assert.hpp:43:5: note: expanded from macro
'BOOST_CONCEPT_ASSERT'
    BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
    ^
/mnt/d/boost.wsl/boost/concept/detail/general.hpp:71:25: note: expanded from
macro 'BOOST_CONCEPT_ASSERT_FN'
    &::boost::concepts::requirement_<ModelFnPtr>::failed>    \
                        ^
clang_warn_no_constructor_for_refconst.cpp:6:12: note: in instantiation of
function template specialization
      'boost::function_requires<boost::EqualityComparableConcept<const int &>
>' requested here
    boost::function_requires
           ^
/mnt/d/boost.wsl/boost/concept_check.hpp:238:8: note: reference member 'a' will
never be initialized
    TT a, b;
       ^
/mnt/d/boost.wsl/boost/concept_check.hpp:238:11: note: reference member 'b'
will never be initialized
    TT a, b;
          ^
1 warning generated.
```


There is no way to disable this

```
warning: struct 'EqualityComparable<const int &>' does not declare any
constructor to initialize its non-modifiable members
```

Although I understand and agree with rationale provided by Chandler here
https://softwareengineering.stackexchange.com/questions/122608/clang-warning-flags-for-objective-c-development/124574#124574,
to warning about "never really correct" code, I think that in this particular
use case of the Boost.ConceptCheck library, it is Okey to expect to be able to
disable the warn_no_constructor_for_refconst (and similar).

The PITA is that for any non-trivial size of templated library that makes use
of  Boost.ConceptCheck, compilation with Clang leads to a flood of warning.
As side effect, it causes trouble when compiling on popular CI services
available for open source projects (timeouts, builds killed due to logs too
long  etc.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190505/f061bd2f/attachment.html>


More information about the llvm-bugs mailing list