-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
c++ interopFeature: Interoperability with C++Feature: Interoperability with C++
Description
We should emit a diagnostic when swift attributes are not used as intended.
Some examples:
- multiple attributes of the same kind should trigger a warning
template<typename T>
struct SWIFT_COPYABLE_IF(T) SWIFT_NONCOPYABLE DoubleAnnotation {};
// We currently ignore SWIFT_COPYABLE_IF quietly, but we should let the user know
template<typename T, typename S>
struct SWIFT_COPYABLE_IF(T) SWIFT_COPYABLE_IF(S) DoubleAnnotation {};
// We currently merge the two attributes,
// so that DoubleAnnotation is copyable if both T and S are copyable
template<typename T, typename S>
struct SWIFT_NONESCAPABLE SWIFT_NONESCAPABLE DoubleAnnotation {};
// No harm done in the duplicate annotation, but also no reason to do this
- in the presence of
SWIFT_NONCOPYABLE
andSWIFT_COPYABLE_IF
, orSWIFT_NONESCAPABLE
andSWIFT_ESCAPABLE_IF
, we give precedence to the first attribute and thus never parse the second one. If the second attribute contains garbage, we should emit a diagnostic even if this attribute is ignored
template<typename T>
struct SWIFT_COPYABLE_IF(garbage) SWIFT_NONCOPYABLE InvalidAnnotation {};
// "garbage" is invalid, but we don't get a diagnostic
Metadata
Metadata
Assignees
Labels
c++ interopFeature: Interoperability with C++Feature: Interoperability with C++