Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADT] Fix missing 'template' keyword #98252

Closed
wants to merge 1 commit into from

Conversation

sdkrystian
Copy link
Member

Fixes instances where the template keyword should be used to interpret < as the delimiter of a template-argument-list after #92957.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 10, 2024

@llvm/pr-subscribers-llvm-adt

Author: Krystian Stasiowski (sdkrystian)

Changes

Fixes instances where the template keyword should be used to interpret &lt; as the delimiter of a template-argument-list after #92957.


Full diff: https://github.com/llvm/llvm-project/pull/98252.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/ArrayRef.h (+2-2)
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index ac40ec4a6b240..18fff7808ace1 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -460,8 +460,8 @@ namespace llvm {
 
     OwningArrayRef &operator=(OwningArrayRef &&Other) {
       delete[] this->data();
-      this->MutableArrayRef<T>::operator=(Other);
-      Other.MutableArrayRef<T>::operator=(MutableArrayRef<T>());
+      this->template MutableArrayRef<T>::operator=(Other);
+      Other.template MutableArrayRef<T>::operator=(MutableArrayRef<T>());
       return *this;
     }
 

@sdkrystian sdkrystian requested a review from cor3ntin July 10, 2024 00:15
Comment on lines +463 to +464
this->template MutableArrayRef<T>::operator=(Other);
Other.template MutableArrayRef<T>::operator=(MutableArrayRef<T>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with Ubuntu-20.04 g++.

llvm/include/llvm/ADT/ArrayRef.h:463:40: error: expected ‘;’ before ‘::’ token
  463 |       this->template MutableArrayRef<T>::operator=(Other);
      |                                        ^~
      |                                        ;
llvm/include/llvm/ADT/ArrayRef.h:464:40: error: expected ‘;’ before ‘::’ token
  464 |       Other.template MutableArrayRef<T>::operator=(MutableArrayRef<T>());
      |                                        ^~
      |                                        ;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be a GCC bug. Requesting guidance from @AaronBallman @erichkeane @zygoloid.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we revert for now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chapuni I dont think this is something that can be fixed in clang. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94799

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we should revert #92957 for now, unless excluding problematic host compilers would be agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants