title: Why can I create user defined structured bindings for glm::vec in MSVC and icc, but not Clang and GCC?
body: <p>I've been using code similar to the following in MSVC projects for the last year or so, and ran into an issue trying to use it with g++. </p>
  
  <pre><code>#include &lt;utility&gt;
  #include &lt;glm/glm.hpp&gt;
  
  namespace std {
    template&lt; std::size_t I, auto N, class T, auto Q&gt;
    constexpr auto&amp; get(glm::vec&lt;N, T, Q&gt;&amp; v) noexcept { return v[I]; }
  
    template&lt; std::size_t I, auto N, class T, auto Q&gt;
    constexpr const auto&amp; get(const glm::vec&lt;N, T, Q&gt;&amp; v) noexcept { return v[I]; }
  
    template&lt; std::size_t I, auto N, class T, auto Q&gt;
    constexpr auto&amp;&amp; get(glm::vec&lt;N, T, Q&gt;&amp;&amp; v) noexcept { return std::move(v[I]); }
  
    template&lt; std::size_t I, auto N, class T, auto Q&gt;
    constexpr const auto&amp;&amp; get(const glm::vec&lt;N, T, Q&gt;&amp;&amp; v) noexcept { return std::move(v[I]); }
  
    template &lt;auto N, class T, auto Q&gt;
    struct tuple_size&lt;glm::vec&lt;N, T, Q&gt;&gt; : std::integral_constant&lt;std::size_t, N&gt; { };
  
    template &lt;std::size_t I, auto N, class T, auto Q&gt;
    struct tuple_element&lt;I, glm::vec&lt;N, T, Q&gt;&gt; {
      using type = decltype(get&lt;I&gt;(declval&lt;glm::vec&lt;N,T,Q&gt;&gt;()));
    };
  }// end std
  
  
  auto f(){
    auto [x,y,z] = glm::vec3(1);
    return x + y + z;
  }
  
  </code></pre>
  
  <p>GCC gives the error <code>error: 'get' was not declared in this scope; did you mean 'std::get'?</code><br>
  Clang gives the error <code>error: use of undeclared identifier 'get'</code><br>
  icc and MSVC both compile properly.</p>
  
  <p>I'm wondering if this has something to do with GLM's implementation, because I've never had issues with custom structured bindings with GCC in the past.</p>
  
  <p>&nbsp;</p>
  
  <p>I was wondering if anyone knows what is going on here. Are icc and MSVC behaving incorrectly by accepting the code, or are Clang and GCC behaving incorrectly by rejecting the code?</p>
  
  <p>Here's an example of the four different compilers handling this on Compiler Explorer:
  <a href="https://godbolt.org/z/6PCWyn" rel="nofollow noreferrer">https://godbolt.org/z/6PCWyn</a></p>