Skip to content
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

boost::rational issue with ios_base constructor #44

Open
john-d-murphy opened this issue Jul 18, 2020 · 2 comments
Open

boost::rational issue with ios_base constructor #44

john-d-murphy opened this issue Jul 18, 2020 · 2 comments

Comments

@john-d-murphy
Copy link

Code fails to compile if boost::rational is used as the parameter to a function that also shares a signature with a void* - for example:

#include <boost/rational.hpp>

void foo(void(*)()) {}
void foo(boost::rational<int>) {}

void fun() {}

int main() {
  foo(fun);
}

https://wandbox.org/permlink/a06FvkYIP5asIys0

This returns an error in from /opt/wandbox/gcc-head/include/c++/11.0.0/bits/ios_base.h:41,

Apologies since I'm not familiar with the code enough to give a better example/understanding of what's happening. Please let me know what other information I can provide or how I can help get this sorted.

thanks,
John

@mclow
Copy link
Contributor

mclow commented Jul 18, 2020

It looks to me like it trying to instantiate std::numeric_limits<void ()> which doesn't go well.

/opt/wandbox/gcc-head/include/c++/11.0.0/limits: In instantiation of 'struct std::numeric_limits<void()>':
/opt/wandbox/boost-1.73.0/gcc-head/include/boost/rational.hpp:123:7:   required from 'const bool boost::rational_detail::is_compatible_integer<void(), int, void>::value'
/opt/wandbox/boost-1.73.0/gcc-head/include/boost/rational.hpp:184:21:   required by substitution of 'template<class T> constexpr boost::rational<int>::rational(const T&, const typename boost::enable_if_c<boost::rational_detail::is_compatible_integer<T, int, void>::value, void>::type*) [with T = void()]'
prog.cc:9:10:   required from here

@mclow
Copy link
Contributor

mclow commented Jul 18, 2020

Also, I get the same error from clang/libc++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants