title: GCC 7 compilation error when using std::addressof
body: <p>I am observing some strange behavior that I can't quite explain myself.
  The code looks like this:</p>
  
  <pre><code>#include &lt;memory&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  
  int main(){
      std::vector&lt;double&gt; t1(10, 5.0);
      std::vector&lt;double*&gt; t2(10);
      std::transform(t1.begin(), t1.end(), t2.begin(), std::addressof&lt;double&gt;);
      //std::transform(t1.begin(), t1.end(), t2.begin(), [](double&amp; a){return &amp;a;});
  }
  </code></pre>
  
  <p>And here is a version to play around with <a href="https://godbolt.org/g/YcNdbf" rel="nofollow noreferrer">https://godbolt.org/g/YcNdbf</a>
  The problem is that this code compiles fine using gcc4.9-6.3 but fails under gcc 7.1. Clang doesn't like it either.</p>
  
  <p>(edit) Error messages from gcc 7.1:</p>
  
  <pre><code>&lt;source&gt;: In function 'int main()':
  8 : &lt;source&gt;:8:76: error: no matching function for call to 'transform(std::vector&lt;double&gt;::iterator, std::vector&lt;double&gt;::iterator, std::vector&lt;double*&gt;::iterator, &lt;unresolved overloaded function type&gt;)'
       std::transform(t1.begin(), t1.end(), t2.begin(), std::addressof&lt;double&gt;);
                                                                              ^
  In file included from /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/algorithm:62:0,
                   from &lt;source&gt;:3:
  /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/bits/stl_algo.h:4281:5: note: candidate: template&lt;class _IIter, class _OIter, class _UnaryOperation&gt; _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)
       transform(_InputIterator __first, _InputIterator __last,
       ^~~~~~~~~
  /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/bits/stl_algo.h:4281:5: note:   template argument deduction/substitution failed:
  8 : &lt;source&gt;:8:76: note:   could not resolve address from overloaded function 'addressof&lt;double&gt;'
       std::transform(t1.begin(), t1.end(), t2.begin(), std::addressof&lt;double&gt;);
                                                                              ^
  In file included from /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/algorithm:62:0,
                   from &lt;source&gt;:3:
  /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/bits/stl_algo.h:4318:5: note: candidate: template&lt;class _IIter1, class _IIter2, class _OIter, class _BinaryOperation&gt; _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)
       transform(_InputIterator1 __first1, _InputIterator1 __last1,
       ^~~~~~~~~
  /opt/compiler-explorer/gcc-7.1.0/include/c++/7.1.0/bits/stl_algo.h:4318:5: note:   template argument deduction/substitution failed:
  8 : &lt;source&gt;:8:76: note:   could not resolve address from overloaded function 'addressof&lt;double&gt;'
       std::transform(t1.begin(), t1.end(), t2.begin(), std::addressof&lt;double&gt;);
                                                                              ^
  Compiler exited with result code 1
  </code></pre>
  
  <p>However, I can't quite figure out why it is not working.</p>
  
  <p>Thanks in advance to anyone trying to help :)</p>