aaron.ballman added a comment.

The changes so far look sensible, but I think we should add some more tests for 
a few situations. 1) Using a const weak symbol as a valid initializer should be 
diagnosed (with a warning? with an error?) so users are alerted to the 
behavioral quirks. 2) Using a const weak symbol in a constant expression 
context should probably be an error, right? e.g.,

  const int hmm __attribute__((weak)) = 12;
  int erp = hmm; // Error in C, dynamic init in C++?
  
  int main() {
    int blerp = hmm; // OK in both languages
    constexpr int derp = hmm; // Error in C++
    int array[hmm]; // Error in both languages
  }

Also, this definitely could use a release note so users know about the 
behavioral change.

Do you have any ideas on how much code this change is expected to break? (Is it 
sufficient enough that we want to have an explicit deprecation period of the 
existing behavior before we switch to the new behavior?)



================
Comment at: clang/include/clang/Basic/Attr.td:2962
   let Subjects = SubjectList<[Var, Function, CXXRecord]>;
-  let Documentation = [Undocumented];
+  let Documentation = [WeakDocs];
   let SimpleHandler = 1;
----------------
THANK YOU!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126324

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to