This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add test for CWG418
ClosedPublic

Authored by Endill on Dec 6 2022, 6:59 AM.

Details

Reviewers
shafik
Group Reviewers
Restricted Project
Commits
rG90d4cbb87ce2: [clang] Add test for CWG418
Summary

P1787: CWG418 is resolved by trivial rephrasing along with that necessary for the new using-declaration interpretation.
Wording: see changes to [dcl.fct.default]/9 and [over.match.best]/4.

[over.match.best]/4 includes an example that is not properly diagnosed by Clang.

Diff Detail

Event Timeline

Endill created this revision.Dec 6 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 6:59 AM
Endill requested review of this revision.Dec 6 2022, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 6:59 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I'm not sure how I feel about this.
Clang does not, implement correctly that paragraph at all, so I think the best course here is to create an issue on the llvm github and mark the dr resolved as part of fixing the bug in clang.
The fact the previous wording was unclear may be related to clamg non-conformance.

shafik added a subscriber: shafik.Dec 6 2022, 8:12 AM

I think the relevant change from p1787 is to dcl.fct.default p4, specifically:

... Declarations that inhabit different scopes have completely distinct sets of default arguments ...

shafik added a comment.Dec 6 2022, 8:13 AM

I'm not sure how I feel about this.
Clang does not, implement correctly that paragraph at all, so I think the best course here is to create an issue on the llvm github and mark the dr resolved as part of fixing the bug in clang.
The fact the previous wording was unclear may be related to clamg non-conformance.

I agree, I don't believe we are conforming and there should be a bug report.

Endill added a comment.Dec 6 2022, 8:30 AM

I think the relevant change from p1787 is to dcl.fct.default p4, specifically:

... Declarations that inhabit different scopes have completely distinct sets of default arguments ...

It previously said "Declarations in different scopes". To me it's no more that adjusting the wording to the new language of lookup, keeping the intent intact. Am I missing more serious consequences of this change?

shafik added a comment.Dec 6 2022, 9:44 AM

I think the relevant change from p1787 is to dcl.fct.default p4, specifically:

... Declarations that inhabit different scopes have completely distinct sets of default arguments ...

It previously said "Declarations in different scopes". To me it's no more that adjusting the wording to the new language of lookup, keeping the intent intact. Am I missing more serious consequences of this change?

I think your correct on this.

Endill added a comment.Dec 6 2022, 9:53 AM

I opened #59363 on bug tracker.
What should I do about this patch then? I believe availability no should come with a failing test. Should I include example from [over.match.best]/4 as another example in the test?

I opened #59363 on bug tracker.
What should I do about this patch then? I believe availability no should come with a failing test. Should I include example from [over.match.best]/4 as another example in the test?

Was chatting with @aaron.ballman and he recommends adding a FIXME comment along the lines of:

// FIXME: this shouldn't pass, it should fail!

@shafik does this imply that example from [over.match.best]/4 should be included in this patch?

@shafik does this imply that example from [over.match.best]/4 should be included in this patch?

Yes, I believe we should. We are only conforming if we get all of the cases correct.

Endill updated this revision to Diff 480848.Dec 7 2022, 4:11 AM
Endill edited the summary of this revision. (Show Details)

Add example from [over.match.best]/4, and mark CWG418 as not available

shafik accepted this revision.Dec 7 2022, 7:42 AM

LGTM, thank you for all your efforts.

This revision is now accepted and ready to land.Dec 7 2022, 7:42 AM
Endill added a comment.Dec 7 2022, 7:55 AM

Thanks to all of you for your time to review this.

This revision was automatically updated to reflect the committed changes.