Abstract declarator contexts (specifically `DeclaratorContext::TypeName`) now properly bypass this restricted rule, allowing cv-qualified function types in `__typeof__` while maintaining restrictions in other contexts like `typeid`, `sizeof`, C-style casts, and `new` expressions per CWG1417.
On top of updating the status page, this PR updates the `latest_release`
constant to 22 and fixes a small `cwg_index.html` parsing issue that
arose during the update.
Add support for _if declarations_ in `C2y` mode by exploiting existing
C++ code.
The only new changes to the code is narrowing the code path to `C` mode
and introduce new errors and warnings for some pitfalls with the syntax
and what is expected from the standard and old language modes.
It should be noted that the first clause in the standard paper can only
be declaration. This means we can't allow expression statement in the
first clause of the condition, and that's the goal of the new
warnings/errors. Also this is different from C++ grammar.
This implements C++26's expansion statements, i.e.
[P1306R5](https://wg21.link/P1306R5).
An expansion statement is implemented using a number of new AST
nodes. Since an expansion statement is a template, we need it to be
a dependent DeclContext, but only nodes that inherit from Decl can
be DeclContexts, for which reason this introduces a CXXExpansionStmtDecl.
This holds a synthesised constant template parameter used as the
expansion index as well as a 'CXXExpansionStmtPattern' and a
'CXXExpansionStmtInstantiation.
These two AST nodes are similar to the semantic vs syntactic form
of an InitListExpr: the 'Pattern' represents an unexpanded expansion
statement, and the resulting AST after expansion is stored in an
'Instantiation'.
Since expansion statements require us to perform template instantiation
*inside* a function without instantiating the rest of a function, I had to
remove a number of assertions in the template instantiation engine (e.g.
the assertion that a function parameter must always have an instantiation
by the time we encounter a DeclRefExpr to it no longer holds).
For more implementation details, see the corresponding doc comments
in DeclTemplate.h and StmtCXX.h.
There is some follow up work to be done after this lands, which is
tracked in #207776.
This adds diagnostic groups, command-line options, a language option,
and various other things required to support `-std=c++2d`. I haven’t
touched e.g. clang-tidy or clang-format, as I’m not really familiar w/
either. This is only meant to add the most necessary parts to support
C++29 mode.
I grepped for `CPlusPlus26`/`C++26`/`C++2c` and updated all places I
could find where we need to handle every language mode in some way or
another.
This patch is roughly based on b763d6a4ed.
Adds a test for [CWG3129](https://wg21.link/CWG3129) "Clarify which floating-point-literals are valid".
Clang has supported floating-point literals with overly tiny or huge
exponents since 3.0, with only a warning emitted.
The post-Brno draft will not be out for three more weeks, but Brno
updates for Core issues statuses are already trickling in.
Notably, [CWG507](https://cplusplus.github.io/CWG/issues/507.html)
"Ambiguity with built-in binary operator candidates for class object
convertible to built-in type", which used to be marked as a duplicate of
[CWG260](https://cplusplus.github.io/CWG/issues/260.html) "User-defined
conversions and built-in `operator=`", is open again, presumably because
it contains an example that goes beyond the scope of CWG260. Relatively
recent CWG thread that might be related (WG21 access required):
[link](https://lists.isocpp.org/core/2025/08/18478.php).
N2601 is what added Annex H for the interchange and extended floating
point types.
N2844 removed default argument promotions for the types in Annex H.
So these two proposals really do go together.
This commit implements the final parts of the roadmap described in issue
#190973 by merging the class `LocationContext` into the class
`StackFrame` and replacing `LocationContext` with `StackFrame`
throughout the analyzer.
This patch implements
[CWG3135](https://cplusplus.github.io/CWG/issues/3135.html). This has
been accepted into C++26 at the Croydon meeting through [CWG Motion
3](https://github.com/cplusplus/draft/issues/8824).
This change has not been designated a defect report. However, there was
recently some discussion about this designation and GCC implements it as
DR. Therefore, this is treated as DR regardless.
As reported in #197930, these new tests fail on the
`arm64-apple-darwin-unknown` target. There's not a consensus yet on how
to fix the breakage, so revert it until we can decide.
[CWG941](https://wg21.link/cwg941) allowed specializing deleted function
templates. Clang accepted this between 2.7 and 2.9, regressed and
started emitting redefinition errors between 3.0 and 3.8, then went back
to accepting in 3.9: https://godbolt.org/z/GKnf9je7j. I've marked it as
implemented since 3.9.
[CWG988](https://wg21.link/cwg988) specifies that reference collapsing
is performed when trying to form a reference to a `decltype`. Clang
implements this since 2.7: https://godbolt.org/z/vYzKbv8x7 (and I
checked a few versions after that to make sure there were no
regressions).
[CWG1336](https://wg21.link/cwg1336) clarifies that, as long as it isn't
explicit, a constructor is still a converting constructor even if it has
multiple arguments. Clang seems to implement this since 3.1:
https://godbolt.org/z/919zdMd3h (I checked a few versions following 3.1
as well, and didn't notice any regressions).
[CWG2785](https://wg21.link/cwg2785) clarifies that a
*requires-expression* is never type-dependent, it always has type
`bool`. That means that in a snippet like this:
```cpp
void g(void *);
template <typename T>
void f() {
g(requires { T(); });
}
```
The call to `g` should be diagnosed as invalid (`bool` is not
convertible to `void *`) even if the template is never instantiated.
Clang does the right thing since version 10:
https://godbolt.org/z/s61rEbsfz
This is ill-formed:
```cpp
switch (0.0) {}
```
Before [CWG2629](https://wg21.link/cwg2629) though, this was allowed:
```cpp
switch (double d = 0.0) {} // Value of 'd' is implicitly converted to an integer
```
Clang however has always rejected both: https://godbolt.org/z/GYc4hhrnz
CWG2807 (https://wg21.link/cwg2807): One part of the standard correctly
said destructors can't be `consteval`, but another incorrectly said they
can be.
Clang diagnosed this in 9.0, for some reason started accepting it in
10.0, then went back to diagnosing in 11.0:
https://godbolt.org/z/6sWTYT38M. I've marked it as implemented since
11.0.
The issue that prompted the DR: #65665
CWG2810 (https://cplusplus.github.io/CWG/issues/2810.html) just removes
some wording that could be misinterpreted as saying "a compiler must not
emit any warnings in uninstantiated templates". Clang has never
misinterpreted it that way, so we don't need to do anything here.
There are a large number of long standing issues with coroutines on
x86_32 windows as discussed here
https://github.com/llvm/llvm-project/issues/59382
- #59382
- #58556
- #58543
- #56989
- #193161
- #136481
As such this patches
- No longer defines `__cpp_impl_coroutine` on that platform
- Warn when using coroutines on that platform
The reason to not plainly error is that it would break too much valid
valid code, ie there are people who probably use coroutines sucessfully.
And we also want to keep testing on that platform, up until the point we
were to pull support completely.
Hopefully this is all temporary and someone will feel compelled to
improve the situation enough that we can unceremoniously revert this
patch.
This PR adds tests for
[CWG1670](https://cplusplus.github.io/CWG/issues/1670.html) "`auto` as
_conversion-type-id_" and
[CWG1878](https://cplusplus.github.io/CWG/issues/1878.html) "`operator
auto` template". The long and short of it is that placeholder type
specifier (`auto`) cannot be used to declare conversion function or
conversion function template. We've always diagnosed template case but
not non-template case.
Before
b9c0e590f1
switched the C++ status page to a reverse chronological order, it made
sense to avoid wasting vertical space for already-implemented standards.
After that switch, it would make sense however to unfold them by
default.
This is for example why I had opened #61426, because CRTL+F did not show
P0588 on the status page[^1]. But not just for this paper, I think the
ease of finding papers is a good argument for folding out those tables.
[^1]: together with the fact that other status pages
([example](https://en.cppreference.com/cpp/compiler_support/20)) have
sorted this paper under C++20 rather than C++11.
C11 6.2.2p7 says if the same identifier appears with both internal and
external linkage in a translation unit, the behavior is undefined.
This patch adds a check in `Sema::MergeVarDecl` that uses
`LookupResult::isShadowed()` to detect when a block-scope `extern` found
a file-scope `static` through a shadow, and emits an error.
Fixes#54215
Clang allows friend declarations of closure type members, which is
disallowed per CWG 1780 (Issue #26540).
Added a new diagnostic when the friend declaration targets a member of a
`CXXRecordDecl` that is a lambda.
---------
Co-authored-by: Corentin Jabot <corentinjabot@gmail.com>
The following features are now released and should be marked as such:
Named loops, v3 -> e4a1b5f
_COUNTER pre-defiend macro: -> df1d786
Allow calling static inline within extern inline: -> 8e60adc