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

Keyword-like forms of logical operators are not supported in C++ requires clause #10506

Closed
MiroPalmu opened this issue Dec 22, 2023 · 9 comments
Labels
C/C++ enhancement a request to enhance doxygen, not a bug

Comments

@MiroPalmu
Copy link

Describe the bug
Keyword-like forms of logical operators and, or and not are not supported in required clause.

For example for following class:

template<typename T>
    requires std::is_enum_v<T> and std::unsigned_integral<std::underlying_type_t<T>>
class flags_t {...};

"Detailed Description" in html documentation would contain:

template<typename T>
requires std::is_enum_v<T>
class idg::sstd::flags::flags_t< T >

If one would change and -> && missing std::unsigned_integral<std::underlying_type_t<T>> would appear in the documentation.

Expected behavior
Support for keyword-like forms of logical opeators.

Screenshots
image

To Reproduce
doxygen_bug.tar.gz

Version
Doxygen 1.9.6 on Arch Linux

Additional context
I don't understand the implementation enough to say for sure but it seems that the bug lies in doxygen/src/scanner.I:2343:

<RequiresClause>"||"|"&&"               { // "requires A || B" or "requires A && B"
                                          yyextra->current->req+=yytext;
                                        }
@albert-github
Copy link
Collaborator

What kind of file is your Doxyfile in the doxygen_bug.tar.gz?

@albert-github albert-github added needinfo reported bug is incomplete, please add additional info C/C++ labels Dec 22, 2023
@albert-github
Copy link
Collaborator

albert-github commented Dec 22, 2023

In your code you have

requires std::is_enum_v<T> and std::unsigned_integral<std::underlying_type_t<T>>
  • from where do you get that the word and is supported?
  • does did this compile?

As part of the draft C++ 2023 standard I see:

requires-clause:
  requires constraint-logical-or-expression

constraint-logical-or-expression:
  constraint-logical-and-expression
  constraint-logical-or-expression || constraint-logical-and-expression

constraint-logical-and-expression:
  primary-expression
  constraint-logical-and-expression && primary-expression

so, I think, for or you have to use ||, for and use && and for not use !.

@doxygen
Copy link
Owner

doxygen commented Dec 22, 2023

@albert-github These are so called "alternative operators", see https://en.cppreference.com/w/cpp/language/operator_alternative

@albert-github
Copy link
Collaborator

@doxygen I see (found them also in the standard as paragraph "5.5 Alternative tokens", some horrible sequences like <% and <: I see there. Maybe we should support the and, or, not as well where now the &&, || and ! are supported (in scanner.l and code.l). Probably some others as well.

@albert-github albert-github added enhancement a request to enhance doxygen, not a bug and removed needinfo reported bug is incomplete, please add additional info labels Dec 22, 2023
@MiroPalmu
Copy link
Author

What kind of file is your Doxyfile in the doxygen_bug.tar.gz?

It is just the default generated one. There is also main.cpp which contains test cases for each and, or and not.

@doxygen
Copy link
Owner

doxygen commented Dec 24, 2023

@doxygen I see (found them also in the standard as paragraph "5.5 Alternative tokens", some horrible sequences like <% and <: I see there. Maybe we should support the and, or, not as well where now the &&, || and ! are supported (in scanner.l and code.l). Probably some others as well.

I think we should definitely not support the weird <% and <: sequences, I've never seen them used, so let's only do the && and || and ! and only at places where they make sense. Note that && is also used for forwarding/move references (see https://stackoverflow.com/a/71285923/784672 for some horrible abuse).

doxygen added a commit that referenced this issue Dec 24, 2023
@doxygen
Copy link
Owner

doxygen commented Dec 24, 2023

@MiroPalmu Please verify if the referenced commit fixes the problem for you. Do not close the issue, this will be done automatically when the next official release becomes available.

@doxygen doxygen added the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label Dec 25, 2023
@MiroPalmu
Copy link
Author

@doxygen Yes, it worked! Thanks for the quick fix :)

@doxygen
Copy link
Owner

doxygen commented Dec 25, 2023

This issue was previously marked 'fixed but not released',
which means it should be fixed in doxygen version 1.10.0.
Please verify if this is indeed the case. Reopen the
issue if you think it is not fixed and please include any additional information
that you think can be relevant (preferably in the form of a self-contained example).

@doxygen doxygen removed the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label Dec 25, 2023
@doxygen doxygen closed this as completed Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C/C++ enhancement a request to enhance doxygen, not a bug
Projects
None yet
Development

No branches or pull requests

3 participants