[PATCH] D77056: RFC: [Sema][SVE] Allow non-member operators for SVE types

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 30 10:49:54 PDT 2020


efriedma added a comment.

I'm concerned we're going to run into trouble if two people define different SVE "libraries", and you try to link both of them into the same program.  If you're not careful, you end up with ODR violations.  The scope of this is sort of restricted in normal C++: class and enumerated types sort of have an informal "owner", and people tend to respect that.  I mean, you could say it's the user's own fault if they break ODR, but we're essentially making a trap here.  Maybe it would make sense to require that SVE operators are defined in a namespace?  That would make the user think about the issue.

We're also basically committing to never building these operators into the compiler, for all sizeless types for all targets.

It would probably make sense to send this to cfe-dev, to get more perspectives on the language change.



================
Comment at: clang/include/clang/AST/Type.h:6833
 inline bool Type::isOverloadableType() const {
-  return isDependentType() || isRecordType() || isEnumeralType();
+  return (isDependentType() || isRecordType() || isEnumeralType() ||
+          isSizelessBuiltinType());
----------------
Unnecessary parentheses


================
Comment at: clang/test/SemaCXX/sizeless-1.cpp:659
+svint8_t &operator--(svint8_t &, int);
+int operator,(svint8_t, svint8_t);
+
----------------
Need some testcases with template operators.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77056/new/

https://reviews.llvm.org/D77056





More information about the cfe-commits mailing list