This is an archive of the discontinued LLVM Phabricator instance.

[C++20] [Modules] Only diagnose the non-inline external variable definitions in header units
ClosedPublic

Authored by ChuanqiXu on Jan 17 2023, 1:31 AM.

Details

Summary

Address part of https://github.com/llvm/llvm-project/issues/60079.

Since the the declaration of a non-inline static data member in its class definition is not a definition. The following form:

class A {
public:
    static const int value = 43; 
};

should be fine to appear in a header unit. From the perspective of implementation, it looks like we simply forgot to check if the variable is a definition...

Diff Detail

Event Timeline

ChuanqiXu created this revision.Jan 17 2023, 1:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 1:31 AM
ChuanqiXu requested review of this revision.Jan 17 2023, 1:31 AM
ChuanqiXu updated this revision to Diff 489736.

Remove redundancy.

iains accepted this revision.Jan 17 2023, 1:36 AM

thanks, LGTM.

This revision is now accepted and ready to land.Jan 17 2023, 1:36 AM
This revision was landed with ongoing or failed builds.Jan 17 2023, 1:48 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 17 2023, 1:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript