-
Notifications
You must be signed in to change notification settings - Fork 13.4k
warn_no_constructor_for_refconst
can not be disabled (Boost.ConceptCheck)
#41104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I failed to reproduce this on compiler explorer. If this is an issue only with old clang on old boost, I am not sure we can really do anything about it. If you have more details or a standalone repro please reopen. |
Screenshot with repro of the issue using clang 12 and Boost 1.77 (develop branch) $ clang++ --version | grep version
Ubuntu clang version 12.0.1-++20210630032618+fed41342a82f-1~exp1~20210630133332.127
$ grep '#define BOOST_VERSION ' /home/mloskot/boost/boost/version.hpp
#define BOOST_VERSION 107700 $ cat test.cpp #include <boost/concept_check.hpp>
int main()
{
using T = int const&;
boost::function_requires<boost::EqualityComparableConcept<T>>();
} $ clang++ -std=c++11 -I/home/mloskot/boost test.cpp
In file included from test.cpp:1:
/home/mloskot/boost/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))
^
/home/mloskot/boost/boost/concept_check.hpp:231:17: note: in instantiation of template class 'boost::EqualityComparable<const int &>' requested here
/home/mloskot/boost/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);
^
/home/mloskot/boost/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) );
^
/home/mloskot/boost/boost/concept/detail/general.hpp:74:19: note: in instantiation of template class 'boost::concepts::not_satisfied<boost::EqualityComparableConcept<const int &>>' requested here
concepts::not_satisfied<Model>::value
^
/home/mloskot/boost/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));
^
/home/mloskot/boost/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
^
/home/mloskot/boost/boost/concept/detail/general.hpp:92:25: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
^
test.cpp:5:12: note: in instantiation of function template specialization 'boost::function_requires<boost::EqualityComparableConcept<const int &>>' requested here
boost::function_requires<boost::EqualityComparableConcept<T>>();
^
/home/mloskot/boost/boost/concept_check.hpp:238:8: note: reference member 'a' will never be initialized
TT a, b;
^
/home/mloskot/boost/boost/concept_check.hpp:238:11: note: reference member 'b' will never be initialized
TT a, b;
^
1 warning generated. |
@Matheus Izvekov I asked here https://cpplang.slack.com/archives/C28NX7947/p1627297817121500 https://godbolt.org/z/os4YGMoe3 So, I've reopened the bug. |
warn_no_constructor_for_refconst
can not be disabled (Boost.ConceptCheck)
I put this under -Wunitialized because that's the same group it's under in GCC. Fixes llvm#41104
@llvm/issue-subscribers-clang-frontend Author: Mateusz Łoskot (mloskot)
| | |
| --- | --- |
| Bugzilla Link | [41759](https://llvm.org/bz41759) |
| Version | unspecified |
| OS | Linux |
| CC | @dwblaikie,@DougGregor,@mizvekov,@zygoloid |
Extended DescriptionThe 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
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 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. |
I put this under -Wunitialized because that's the same group it's under in GCC. Fixes llvm#41104
I put this under -Wunitialized because that's the same group it's under in GCC. Fixes llvm#41104
Extended Description
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:
will trigger a flood of warnings:
There is no way to disable this
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.)
The text was updated successfully, but these errors were encountered: