Skip to content

Return-type based SFINAE detection doesn't output any requires clause #849

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

Closed
anarthal opened this issue Jan 31, 2025 · 2 comments
Closed

Comments

@anarthal
Copy link

If SFINAE is used in the return type, the relevant std::enable_if is stripped, but no requires clause is output:

#include <type_traits>

namespace boost::mysql {

template <typename T>
std::enable_if_t<std::is_class_v<T>, int> f();

}  // namespace boost::mysql

Renders:

Image

$> mrdocs --version
MrDocs
    C++ Documentation Tool
    version: 0.0.3
    build: 93d5d102c39b093d402ae3f95302fd734c8de616
    built with LLVM 20.0.0git
@alandefreitas
Copy link
Collaborator

This worked in develop so it's probably been fixed since 93d5d10 and there's something else causing this problem. We already have tests for return-type based sfinae. In any case, I added one more test:

// issue #849

#include <type_traits>

template <typename T>
std::enable_if_t<std::is_class_v<T>, int> f();

Result:

Reference

Global namespace

Functions

Name
f

f

Synopsis

Declared in <return-based.cpp>

template<typename T>
int
f()
requires std::is_class_v<T>;

Created with MrDocs

alandefreitas added a commit to alandefreitas/mrdocs that referenced this issue Jan 31, 2025
@anarthal
Copy link
Author

anarthal commented Feb 1, 2025

Confirming this works in develop. Thanks.

@anarthal anarthal closed this as completed Feb 1, 2025
alandefreitas added a commit that referenced this issue Feb 1, 2025
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