[01/23] vec: Silence clang warning

Message ID mptd00had6p.fsf@arm.com
State New
Headers show
Series
  • Make fwprop use an on-the-side RTL SSA representation
Related show

Commit Message

Xi Ruoyao via Gcc-patches Nov. 13, 2020, 8:11 a.m.
I noticed during compatibility testing that clang warns that this
operator won't be implicitly const in C++14 onwards.

gcc/
	* vec.h (vnull::operator vec<T, A, L>): Make const.
---
 gcc/vec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

Comments

Xi Ruoyao via Gcc-patches Nov. 25, 2020, 7:58 p.m. | #1
On 11/13/20 1:11 AM, Richard Sandiford via Gcc-patches wrote:
> I noticed during compatibility testing that clang warns that this

> operator won't be implicitly const in C++14 onwards.

>

> gcc/

> 	* vec.h (vnull::operator vec<T, A, L>): Make const.

OK
jeff

Patch

diff --git a/gcc/vec.h b/gcc/vec.h
index 14d77e87342..f02beddc975 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -540,7 +540,7 @@  vec_copy_construct (T *dst, const T *src, unsigned n)
 struct vnull
 {
   template <typename T, typename A, typename L>
-  CONSTEXPR operator vec<T, A, L> () { return vec<T, A, L>(); }
+  CONSTEXPR operator vec<T, A, L> () const { return vec<T, A, L>(); }
 };
 extern vnull vNULL;