Skip to content

fix(sema): skip scope only when the using shadows #965

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

Merged
merged 4 commits into from
Feb 6, 2024

Conversation

JohelEGP
Copy link
Contributor

@JohelEGP JohelEGP commented Feb 5, 2024

Resolves #962.

Named returns is orthogonal to last move of `this`.
@JohelEGP JohelEGP marked this pull request as ready for review February 5, 2024 23:06
@JohelEGP JohelEGP changed the title fix(to_cpp1): skip scope only when the using shadows fix(sema): skip scope only when the using shadows Feb 5, 2024
@hsutter
Copy link
Owner

hsutter commented Feb 6, 2024

Thanks!

I'm not sure this resolves #962 yet though?

prntln: (s: ::std::string) = {
  using ::std;
  cout << "A: (s)$" << endl;
}

@JohelEGP
Copy link
Contributor Author

JohelEGP commented Feb 6, 2024

I changed the added unit test to

issue_962: (s: ::std::string) = {
  using ::std::string;
  std::cout << "A: (s)$" << std::endl;
}

adding ::string to using ::std::string;
because using ::std; should have been using namespace ::std;
but that doesn't reproduce.
Also std::-qualified cout and endl.

@hsutter
Copy link
Owner

hsutter commented Feb 6, 2024

Aha, thanks. I was looking so much at the uses of s that didn't even notice that using ::std; wasn't legal, and the std:: qualifications were missing.

@hsutter hsutter merged commit eb5c65b into hsutter:main Feb 6, 2024
@JohelEGP JohelEGP deleted the last_use branch February 6, 2024 19:59
bluetarpmedia pushed a commit to bluetarpmedia/cppfront that referenced this pull request Feb 7, 2024
* fix(to_cpp1): remove bogus condition

Named returns is orthogonal to last move of `this`.

* fix(sema): skip scope only when the `using` shadows

* test: apply CI patch

* test: use actual reproducer
@wolfseifert
Copy link

Sorry for the wrong test case!

It was meant to be:

issue_962: (s: ::std::string) = {
  using ::std::cout;
  using ::std::endl;
  cout << "A: (s)$" << endl;
}

@JohelEGP
Copy link
Contributor Author

JohelEGP commented Feb 7, 2024

By the way, thank you for the reports, @wolfseifert.

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

Successfully merging this pull request may close these issues.

[BUG] error: local variable not used after using declaration but in fact it is
3 participants