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

!!! BREAKING CHANGE !!! - remove the custom implementation of std::is_constructible and optionally use the <type_traits> header because of infinite template recursion issues with GCC #85

Closed
chambm opened this issue Jul 31, 2017 · 5 comments

Comments

@chambm
Copy link

chambm commented Jul 31, 2017

Description

Template depth exceeded on GCC

Here is a repro:
http://coliru.stacked-crooked.com/a/be9f09a38e109b69

I pasted current doctest.h in there and tacked a test case at the end.

I found the bug working with GCC 4.8.4, so it's not the GCC version. What is that template metaprogramming for in the Approx class? Seems a bit overly complex.

Extra information

  • doctest version: 1.2.1
  • Compiler+version: GCC 7.1.0
@onqtam
Copy link
Member

onqtam commented Aug 3, 2017

interestingly enough clang has no trouble but all versions of GCC fail...

I originally added the is_constructible type trait to support strong typedefs of double for doctest::Approx - and took the implementation from here (and "simplified" it) because using std::is_constructible would require including <type_traits>...

I'm not sure how to proceed with this - it might be a gcc problem, but it is for sure a huge template mess...

sometimes I look back at things I've added and say to myself "what was I thinking"...

@chambm
Copy link
Author

chambm commented Aug 3, 2017

It also works on MSVC 12 and later. At least Update 5. I've seen an internal compiler error with VC 12 update 1 but couldn't figure out how to reproduce it. Been wondering whether it was related to this.

@onqtam
Copy link
Member

onqtam commented Aug 4, 2017

I'll probably address this next week by making a config option (another one... off by default) to support strong typedefs of double for Approx which would trigger including <type_traits> and the use of std::is_constructible - a breaking change for users currently using that...

@chambm
Copy link
Author

chambm commented Aug 4, 2017

A good compromise!

@onqtam onqtam changed the title Template depth exceeded on GCC !!! BREAKING CHANGE !!! - remove the custom implementation of std::is_constructible and optionally use the <type_traits> header Aug 11, 2017
onqtam added a commit that referenced this issue Aug 11, 2017
…and added a config option (DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS) that triggers the inclusion of <type_traits> and enables the ability for the Approx helper to be used with strong typedefs of double - fixes #85 and relates #62

also changed links to paypal to have a default amount
@onqtam onqtam changed the title !!! BREAKING CHANGE !!! - remove the custom implementation of std::is_constructible and optionally use the <type_traits> header !!! BREAKING CHANGE !!! - remove the custom implementation of std::is_constructible and optionally use the <type_traits> header because of infinite template recursion issues with GCC Aug 11, 2017
@onqtam
Copy link
Member

onqtam commented Aug 11, 2017

this is now in the dev branch - soon I'll release version 1.2.2 with this going into master.

onqtam added a commit that referenced this issue Aug 11, 2017
… when constructing doctest::Approx which only takes double by default - relates #85
@onqtam onqtam closed this as completed in 69d3c9e Sep 5, 2017
onqtam added a commit that referenced this issue Sep 5, 2017
… when constructing doctest::Approx which only takes double by default - relates #85
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