[clang] [C++26][clang] Implement P2795R5 'Erroneous behaviour for uninitialized reads' (PR #177614)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 23 09:12:29 PST 2026
================
@@ -3426,6 +3428,27 @@ static void mergeParamDeclAttributes(ParmVarDecl *newDecl,
diag::note_carries_dependency_missing_first_decl) << 1/*Param*/;
}
+ // C++26 [dcl.attr.indet]/p2:
+ // If a function parameter is declared with the indeterminate attribute, it
+ // shall be so declared in the first declaration of its function. If a
+ // function parameter is declared with the indeterminate attribute in the
+ // first declaration of its function in one translation unit and the same
+ // function is declared without the indeterminate attribute on the same
+ // parameter in its first declaration in another translation unit, the program
+ // is ill-formed, no diagnostic required.
+ if (S.getLangOpts().CPlusPlus26) {
----------------
erichkeane wrote:
These are still valuable warnings in pre-26, IMO, we should apply this attribute as an extension backwards.
https://github.com/llvm/llvm-project/pull/177614
More information about the cfe-commits
mailing list