Skip to content

Commit

Permalink
[clang] assume_aligned incorrectly diagnoses a dependent return type
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Oct 8, 2024
1 parent 7e31eaa commit fd3247e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,8 @@ static void handlePreferredName(Sema &S, Decl *D, const ParsedAttr &AL) {

bool Sema::isValidPointerAttrType(QualType T, bool RefOkay) {
if (RefOkay) {
if (T->isDependentType())
return true;
if (T->isReferenceType())
return true;
} else {
Expand Down
3 changes: 3 additions & 0 deletions clang/test/SemaCXX/builtin-assume-aligned-tmpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ T *atest3() __attribute__((assume_aligned(31, o))); // expected-error {{requeste
template <typename T, int o>
T *atest4() __attribute__((assume_aligned(32, o)));

template<typename T>
T atest5(int) __attribute__((assume_aligned(2)));

void test22() {
atest3<int, 5>();
atest4<int, 5>();
Expand Down

0 comments on commit fd3247e

Please sign in to comment.