This is an archive of the discontinued LLVM Phabricator instance.

[clang] Treat function parameter scope as an immediate function context
ClosedPublic

Authored by Fznamznon on Mar 3 2023, 8:59 AM.

Details

Summary

This results in expressions that appear in default function argument not
being checked for being actual constant expressions.
This aligns clang's behavior with the standard and fixes one of the
examples from https://wg21.link/P1073R3.

Diff Detail

Event Timeline

Fznamznon created this revision.Mar 3 2023, 8:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 8:59 AM
Fznamznon requested review of this revision.Mar 3 2023, 8:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 8:59 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I think this make sense.
Maybe we should add a comment quoting [expr.const] p15.1 in both places though.

shafik accepted this revision.Mar 6 2023, 11:44 AM

This LGTM, I agree w/ @cor3ntin about quoting [expr.cont] to document this choice.

This revision is now accepted and ready to land.Mar 6 2023, 11:44 AM
Fznamznon updated this revision to Diff 502754.Mar 6 2023, 12:20 PM

Rebase and add quoting [expr.const] p15.1

cor3ntin accepted this revision.Mar 6 2023, 12:22 PM

Thanks, LGTM