We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
C(C&)
A declaration like:
c++decl> explain C(C const&) declare C as constructor (reference to constant C)
(where C has not been predeclared) works because the lexer returns C as a NAME and the parser matches it here:
C
pc99_func_or_constructor_decl_c : Y_NAME '(' param_list_c_ast_opt ')' noexcept_c_stid_opt func_equals_c_stid_opt
In C++, a NAME followed by ( declares an in-class constructor, so we interpret it as such.
(
However, if C is predeclared, then it doesn't work:
c++decl> class C c++decl> explain C(C const&) ^ 12: syntax error: "&": ')' expected
The reason is because the lexer returns C as a type name and the parser tries to match it here:
typed_declaration_c : type_c_ast decl_list_c_opt
as an ordinary typed declaration (which is wrong). The reason is because C++ grammar is ambiguous:
C(x) // declare x as C (with unnecessary parentheses) C(C&) // declare C as constructor
There's no easy fix for this.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
A declaration like:
(where
C
has not been predeclared) works because the lexer returnsC
as a NAME and the parser matches it here:In C++, a NAME followed by
(
declares an in-class constructor, so we interpret it as such.However, if
C
is predeclared, then it doesn't work:The reason is because the lexer returns
C
as a type name and the parser tries to match it here:as an ordinary typed declaration (which is wrong). The reason is because C++ grammar is ambiguous:
There's no easy fix for this.
The text was updated successfully, but these errors were encountered: