This is an archive of the discontinued LLVM Phabricator instance.

Don't track consteval references for dependent members
Needs ReviewPublic

Authored by wchilders on Aug 13 2020, 1:55 PM.

Details

Reviewers
Tyker
rsmith
Summary

Previously dependent references to consteval (ReferenceToConsteval) were tracked, and dependent expressions were evaluated as possible immediate invocations.

This resulted in the evaluation of value dependent expressions.

This patch also suppresses duplicated diagnostics in debug builds while working with templates caused by the side effects of FixOverloadedFunctionReference.

Diff Detail

Event Timeline

wchilders created this revision.Aug 13 2020, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2020, 1:55 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
wchilders requested review of this revision.Aug 13 2020, 1:55 PM

thanks for this,

here is a few comments aside from that this seems fine.

clang/lib/Sema/SemaOverload.cpp
1761

I don't think RebuildingImmediateInvocation should be used here since we are not rebuilding immediate invocations

setSuppressAllDiagnostics or TentativeAnalysisScope seems more adapted.

clang/test/SemaCXX/cxx2a-consteval.cpp
131

could you check that this diagnostic and those like it doesn't appear when the struct A isn't instantiated.

wchilders added inline comments.Aug 14 2020, 1:24 PM
clang/lib/Sema/SemaOverload.cpp
1761

These don't actually work for this use case due to the queuing nature of the diagnostic. Given the hacky nature of this assertion as it stands, I didn't want to further pollute the code base.

I'm open to suggestions. If you're proposing making MarkDeclRefReferenced not queue in response to diagnostic suppression, that doesn't seem totally unreasonable; we'll just have to add the additional condition to check the diagnostic state in MarkDeclRefReferenced.

clang/test/SemaCXX/cxx2a-consteval.cpp
131

I duplicated this namespace without any of the instantiation, and it does seem to trigger the diagnostic "destructor cannot be declared consteval" -- all other diagnostics are silent. Is that particularly undesirable?

Also, WRT testing. would that the best option here (having a duplicated namespace, "dependent_addressing_uninstantiated" -- without the line triggering instantiation)?