Skip to content

Commit 4b6b568

Browse files
authored
Merge pull request #9566 from swiftlang/gaborh/lifetimebound-other-langs
[clang] Permit lifetimebound in all language modes
2 parents e3f0c0d + d737ad9 commit 4b6b568

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,6 @@ def LifetimeBound : DeclOrTypeAttr {
18371837
let Spellings = [Clang<"lifetimebound", 0>];
18381838
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
18391839
let Documentation = [LifetimeBoundDocs];
1840-
let LangOpts = [CPlusPlus];
18411840
let SimpleHandler = 1;
18421841
}
18431842

clang/test/Sema/attr-lifetimebound.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -std=c99 -verify %s
2+
3+
int *f(int* p __attribute__((lifetimebound)));
4+
5+
int *g() {
6+
int i;
7+
return f(&i); // expected-warning {{address of stack memory associated with local variable 'i' returned}}
8+
}

0 commit comments

Comments
 (0)