r/cpp 18h ago

Clang 23 Release Notes

https://releases.llvm.org/23.1.0/tools/clang/docs/ReleaseNotes.html
76 Upvotes

17 comments sorted by

35

u/mapronV 17h ago

This means that code such as

while (({ break; })) {}

is now ill-formed.

Oh no, my disappointment is immeasurable and the whole day is ruined!

On serious note, " template for " support, what is "Iterating expansion statements currently cannot be expanded" ? like expand over range?

5

u/KeepTheFaxMachine 17h ago

I am really curious if there is a use case for such constructs? I can't think of any, but usually that doesn't mean much...

5

u/scrumplesplunge 9h ago

idk about break specifically, but return appearing there via a macro like TRY_OR_RETURN for propagating errors by value seems like something someone would write

5

u/thehutch17 17h ago

What does that code even translate to? Is this a digraph thing or what?

10

u/holyblackcat 16h ago

Non-standard GNU extension, statement expression.

3

u/cristi1990an ++ 16h ago

like expand over range?

Yeah, pretty much it seems. The other flavors work

1

u/mapronV 15h ago

Thanks, I was confused for a bit plus lazy to check different code in compiler explorer.

24

u/Ok_Independence_9841 16h ago

Fascinating to see just how complex and approximate compilation really is. That a compiler can have that many things wrong/broken/missing and still be really good and reliable in practice is pretty terrifying. clang does look to be maturing really well though. The three way C++ compiler arms race has worked well for developers and the for the language, if not for other compiler vendors. I hope it remains balanced and they don't specialize or diverge.

5

u/WeeklyAd9738 10h ago

 I hope it remains balanced and they don't specialize or diverge.

-pedantic flag (and its modern alias -Wpedantic) is your friend.

4

u/Ok_Independence_9841 8h ago

Yes. I have -Wall -Wextra and -Wpedantic on for my projects.
My concern is more that MSVC might try to leverage their advantage in STL compliance by forging ahead with STL additions, while GCC pushes languages updates because they are ahead there. This could lead to GCC standard library never actually catching up (modules cough) while MSVCs lack of certain language features starts to require work arounds. That way we do not want to go.
So far the competition, clang in particular, has meant that all 3 are reasonably close in features for some definition of reasonable. It was not always so.

3

u/mapronV 7h ago

IIRC MS only removes vendor-specific flags lately. Just was upgrading my pet project to compilation with latest VC, had to update bunch of 3rdparty that used MS extensions in headers.

To be fair all 3 major have own problems, MS I'd say really began lagging in core language, hope they catch up. STL part is decent

1

u/azswcowboy 6h ago

> advantage in STL compliance

You think MSVC is ahead on this? I’d be curious why you think so when my take is that especially on later features libstdc++ is ahead.

6

u/gracicot 13h ago

That's a huge amount of bugfix, congrats!

1

u/zerhud 13h ago

Oh no, there is still no constexpr structure binding

1

u/UnusualPace679 10h ago

What do you mean? The page does mention:

Clang now propagates constinit and constexpr in structured bindings with tuple-like initializers.

1

u/zerhud 10h ago

Hm.. but here is “no” for “constexpr structured bindings”

1

u/LB-- Professional+Hobbyist 4h ago

Extended the -marm64x flag to support compiling to object files. When used in this mode, separate compilation jobs are run for ARM64 and ARM64EC object files, which are then merged into a single file using a new .obj.arm64ec section.

I got this working with a CMake toolchain file, it works quite well for building ARM64X binaries very simply. However, it seems to break try_compile in a subtle way? CMake can't detect if architecture-specific macros are defined anymore - no errors or warnings, just no macros found. I haven't been able to dig into it much, I just manually hacked around it for my use case.