Serosh-commits wrote:
> Yeah sorry but none of this makes sense to me. None of the ast nodes are
> marked has having errors, so adding those `containsErrors()` checks makes no
> difference. All those checks in the `Pointer` accessors make no sense since
> that state should never happen.
>
> ```c++
> constexpr const int *foo[][2];
> ```
>
> this declaration gets marked as invalid, so why not
>
> ```c++
> constexpr const int *foo[][2] = { {nullptr, int}, };
> ```
>
> ?
@tbaederr
I noticed ActOnUninitializedDecl marks constexpr variables invalid, but
ActOnInitializerError
doesn't when the initializer fails to parse
Would adding VD->isConstexpr() to ActOnInitializerError be the right fix, or
it will just be masking?
cpp
if (VD->getType()->isUndeducedType() || VD->isConstexpr()) {
D->setInvalidDecl();
return;
}
```"
or let me know is there any good fix u prefer to solve this
> Yeah sorry but none of this makes sense to me. None of the ast nodes are
> marked has having errors, so adding those `containsErrors()` checks makes no
> difference. All those checks in the `Pointer` accessors make no sense since
> that state should never happen.
>
> ```c++
> constexpr const int *foo[][2];
> ```
>
> this declaration gets marked as invalid, so why not
>
> ```c++
> constexpr const int *foo[][2] = { {nullptr, int}, };
> ```
>
> ?
@tbaederr
Sorry for the previous approach I realize now that adding checks in the
interpreter was just masking it
I have been thinking about it and I realized that while
ActOnUninitializedDecl already marks constexpr variables as invalid,
ActOnInitializerError doesn't do the same when an initializer simply fails to
parse. I think this gap is why the interpreter still tries to evaluate them
am I correct that we should just add VD->isConstexpr() to
ActOnInitializerError to stay consistent, or is there a better way to handle
this in Sema?
cpp
if (VD->getType()->isUndeducedType() || VD->isConstexpr()) {
D->setInvalidDecl();
return;
}
```"
if there is there is other way of fixing this can u give me some ideas i would
be happy to implement that
https://github.com/llvm/llvm-project/pull/180261
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits