r/cpp • • 1d ago

Pattern Matching for C++29

https://mpark.github.io/programming/2026/11/30/pattern-matching-for-cpp29/
211 Upvotes

88 comments sorted by

View all comments

Show parent comment

2

u/crowbarous 16h ago

The variables are in nested scopes, so they will shadow one another successfully. Your code as presented is OK if both variables were called, say, DD. A more unfortunate problem is that neither can be called D.