Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(to_cpp1): improve recognition of dependent types and deducible parameters - #533

Closed
ghost wants to merge 3 commits into
mainfrom
unknown repository
Closed

ghost wants to merge 3 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 1, 2023 •

Copy link
Copy Markdown

Resolves #534. Resolves #595.
Resolves #628 (as a discussion, this needs to be manually closed).
Adds what's needed to diagnose #572.

@ghost

This comment was marked as resolved.

@ghost ghost changed the title fix(cpp1): emit typename in dependent type-only contexts fix(cpp1): emit typename/template in unambiguous dependent contexts Jul 4, 2023
Comment thread source/cppfront.cpp Resolved
@ghost ghost changed the title fix(cpp1): emit typename/template in unambiguous dependent contexts fix(cpp1): improve recognition of dependent and deducible parameters Jul 6, 2023
@ghost ghost changed the title fix(cpp1): improve recognition of dependent and deducible parameters fix(cpp1): improve recognition of dependent types and deducible parameters Jul 6, 2023
@ghost
ghost force-pushed the optional_typename branch from ffacee7 to 58ee983 Compare August 14, 2023 15:19
@ghost ghost mentioned this pull request Aug 17, 2023
Comment thread source/cppfront.cpp Resolved
@ghost ghost mentioned this pull request Aug 27, 2023
@ghost
ghost requested a review from hsutter August 29, 2023 19:15
@ghost
ghost force-pushed the optional_typename branch 2 times, most recently from 6262f55 to c1d257b Compare September 13, 2023 22:10
@ghost
ghost force-pushed the optional_typename branch from c1d257b to 15b7551 Compare September 22, 2023 16:45
@ghost
ghost force-pushed the optional_typename branch from 15b7551 to cb586e6 Compare October 3, 2023 18:44
@ghost
ghost force-pushed the optional_typename branch from cb586e6 to 4900c6c Compare October 31, 2023 14:34
Comment thread source/cppfront.cpp Resolved
@ghost
ghost force-pushed the optional_typename branch from b421c19 to ccb10cf Compare November 9, 2023 21:22
@ghost ghost changed the title fix(cpp1): improve recognition of dependent types and deducible parameters fix(to_cpp1): improve recognition of dependent types and deducible parameters Nov 9, 2023
@ghost
ghost force-pushed the optional_typename branch from ccb10cf to 780b99a Compare November 9, 2023 21:23
@ghost
ghost force-pushed the optional_typename branch from 780b99a to ae91505 Compare November 21, 2023 00:36
@ghost
ghost force-pushed the optional_typename branch from b9b5592 to 591cd4b Compare December 11, 2023 16:01
@ghost

ghost commented Dec 12, 2023 •

Copy link
Copy Markdown
Author

Patch for merging with #596:

diff --git a/source/to_cpp1.h b/source/to_cpp1.h
index 5286c3ee..01cb93b5 100644
--- a/source/to_cpp1.h
+++ b/source/to_cpp1.h
@@ -2234,6 +2234,12 @@ public:
         {
             return self->is_dependent(*expr.result_type);
         }
+
+        auto operator()(requires_expression_node const&) const
+            -> bool
+        {
+            return false;
+        }
     };
 
     auto is_dependent(

@ghost
ghost force-pushed the optional_typename branch from d0986ee to 610c254 Compare December 23, 2023 16:12
@ghost

ghost commented Sep 24, 2024 •

Copy link
Copy Markdown
Author

In type-only contexts, we can also allow a space between the identifier and the template-argument-list opener.

assert <_>(); // OK, `<` never an operator.
_ = std::vector <int>(); // Error, `<` interpreted as an operator.
_ = :std::vector <int> = (); // Error, same as above, but as a type-only context, we know it's not an operator.

@ghost
ghost force-pushed the optional_typename branch from 610c254 to ace8cca Compare October 2, 2024 20:23
Comment thread source/to_cpp1.h Resolved
Comment thread source/to_cpp1.h Resolved
Comment thread source/to_cpp1.h Resolved
@ghost
ghost force-pushed the optional_typename branch from b15a82b to eb552be Compare October 9, 2024 17:02
@ghost
ghost force-pushed the optional_typename branch from eb552be to ab00e91 Compare October 9, 2024 18:08
@hsutter

hsutter commented Oct 31, 2024

Copy link
Copy Markdown
Owner

Hi! Sorry it took me so long to get to this one... but this looks like it might still be current. It's a bigger diff, but part of it is the stack_ helpers that got merged from I think another one of your PRs.

Is this up to date, and would you like me to review it?

@hsutter hsutter added the question - further information requested Further information is requested label Oct 31, 2024
@ghost

ghost commented Oct 31, 2024

Copy link
Copy Markdown
Author

Yes, and yes, please do.

^
pure2-bugfix-for-dependent-types-recursion.cpp2:3:13: error: unknown type name 'a'
using b = a;
^

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended that these test cases fail?

  • pure2-bugfix-for-dependent-types-recursion
  • pure2-bugfix-for-dependent-types

For some reason the latter works on GCC 14?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pure2-bugfix-for-dependent-types-recursion should fail.
It tests that the algorithm detects recursio,
and returns false (i.e., "not a dependent type"),
to let the Cpp1 compiler give its diagnostic.

pure2-bugfix-for-dependent-types shouldn't fail on a modern compiler.
I see some are failing because they don't yet support optional typename.

@ghost ghost closed this Feb 14, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Template deduction fails [BUG] Recognize non-deducible parameter

1 participant