The community is trying out a new way to alert interested parties about potentially disruptive changes in pre-release versions of our tools, and this post is the first such attempt at that. We expect to post these announcements to this channel and mark the posts with potentially-breaking so people can more easily be alerted without having to track development progress as closely. We’ve also added a potentially breaking changes section to our release notes to highlight concerns.
As this is the first such post, there are a few potentially breaking changes to Clang that are worth highlighting:
- Clang will now correctly diagnose as ill-formed a constant expression where an enum without a fixed underlying type is set to a value outside the range of the enumeration’s values.
    enum E { Zero, One, Two, Three, Four };
    constexpr E Val1 = (E)3;  // Ok
    constexpr E Val2 = (E)7;  // Ok
    constexpr E Val3 = (E)8;  // Now diagnosed as out of the range [0, 7]
    constexpr E Val4 = (E)-1; // Now diagnosed as out of the range [0, 7]
Due to the extended period of time this bug was present in major C++ implementations (including Clang), this error has the ability to be downgraded into a warning (via: -Wno-error=enum-constexpr-conversion) to provide a transition period for users. This diagnostic is expected to turn into an error-only diagnostic in the next Clang release.
- 
-Wincompatible-function-pointer-typesnow defaults to an error in all C language modes. It may be downgraded to a warning with-Wno-error=incompatible-function-pointer-typesor disabled entirely with-Wno-implicit-function-pointer-types.
    void func(const int *i);
    void other(void) {
      void (*fp)(int *) = func; // Previously a warning, now a downgradable error.
    }
NOTE: We recommend that projects using configure scripts verify that the results do not change before/after setting -Werror=incompatible-function-pointer-types to avoid incompatibility with Clang 16.
- Clang now disallows types whose sizes aren’t a multiple of their alignments to
 be used as the element type of arrays.
  typedef char int8_a16 __attribute__((aligned(16)));
  int8_a16 array[4]; // Now diagnosed as the element size not being a multiple of the array alignment.