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

a read of a variable outside its lifetime is not identified. #8965

Closed
drhaozhong opened this issue Apr 6, 2023 · 1 comment
Closed

a read of a variable outside its lifetime is not identified. #8965

drhaozhong opened this issue Apr 6, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@drhaozhong
Copy link

The code is as follows:

void bar(int n, int x[n]) {}

MSVC reports an error:

(1): error C2131: expression did not evaluate to a constant (1): note: failure was caused by a read of a variable outside its lifetime (1): note: see usage of 'n' Compiler returned: 2

GCC reports a similar error:

error: use of parameter outside function body before ‘]’ token

However, the clang++ in this project does not report any errors.

@drhaozhong drhaozhong added the bug Something isn't working label Apr 6, 2023
@dm-vodopyanov
Copy link
Contributor

Closing due to #8967 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants