Skip to content

Commit fd3247e

Browse files
committed
[clang] assume_aligned incorrectly diagnoses a dependent return type
1 parent 7e31eaa commit fd3247e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,8 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {
12171217

12181218
bool Sema::isValidPointerAttrType(QualType T, bool RefOkay) {
12191219
if (RefOkay) {
1220+
if (T->isDependentType())
1221+
return true;
12201222
if (T->isReferenceType())
12211223
return true;
12221224
} else {

clang/test/SemaCXX/builtin-assume-aligned-tmpl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ T *atest3() __attribute__((assume_aligned(31, o))); // expected-error {{requeste
5252
template <typename T, int o>
5353
T *atest4() __attribute__((assume_aligned(32, o)));
5454

55+
template<typename T>
56+
T atest5(int) __attribute__((assume_aligned(2)));
57+
5558
void test22() {
5659
atest3<int, 5>();
5760
atest4<int, 5>();

0 commit comments

Comments
 (0)