diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index bdf8334f78cea..dbba8f5db0cef 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -365,6 +365,8 @@ Bug Fixes to C++ Support authentication enabled. (#GH152601) - Fix the check for narrowing int-to-float conversions, so that they are detected in cases where converting the float back to an integer is undefined behaviour (#GH157067). +- Stop rejecting C++11-style attributes on the first argument of constructors in older + standards. (#GH156809). - Fix a crash when applying binary or ternary operators to two same function types with different spellings, where at least one of the function parameters has an attribute which affects the function type. diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 10355bb874762..bbeee2e3e373f 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -6007,10 +6007,9 @@ bool Parser::isConstructorDeclarator(bool IsUnqualified, bool DeductionGuide, // A C++11 attribute here signals that we have a constructor, and is an // attribute on the first constructor parameter. - if (getLangOpts().CPlusPlus11 && - isCXX11AttributeSpecifier(/*Disambiguate*/ false, - /*OuterMightBeMessageSend*/ true) != - CXX11AttributeKind::NotAttributeSpecifier) { + if (isCXX11AttributeSpecifier(/*Disambiguate=*/false, + /*OuterMightBeMessageSend=*/true) != + CXX11AttributeKind::NotAttributeSpecifier) { return true; } diff --git a/clang/test/Parser/cxx03-attributes.cpp b/clang/test/Parser/cxx03-attributes.cpp new file mode 100644 index 0000000000000..d3afef76366a3 --- /dev/null +++ b/clang/test/Parser/cxx03-attributes.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 %s +// expected-no-diagnostics + +struct S { + S([[clang::lifetimebound]] int&) {} +};