title: decltype parenthesis syntax for a lvalue
body: <p>I'm trying to have a better understanding of <strong><em>decltype</em></strong> to determine the type of an expression at compile-time. Let's say for example I do it with a double variable:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;type_traits&gt;
  
  int main(){
      double a;
      typedef decltype(a) a_type;
      typedef decltype((a)) ref_a_type;
      typedef decltype(a)&amp; o_ref_a_type;
  
      a_type b;
      ref_a_type c = b;
      o_ref_a_type d = b;
  
    if (std::is_same&lt;decltype(b), double&gt;::value) std::cout &lt;&lt; "b is double\n";
    if (std::is_same&lt;decltype(c), double&amp;&gt;::value) std::cout &lt;&lt; "c is double&amp;\n";
    if (std::is_same&lt;decltype(d), double&amp;&gt;::value) std::cout &lt;&lt; "d is double&amp;\n";
  }
  </code></pre>
  
  <p>If I have understood correctly these points should be true:</p>
  
  <ol>
  <li><code>decltype(a)</code> returns <code>double&amp;</code> if <code>a</code> is a lvalue and <code>double</code> otherwise. </li>
  <li>decltype deduces the type of an expression, unless it is applied to a variable, in which case it deduces the type of that variable.</li>
  <li>If the variable is parenthesized, it becomes an lvalue expression.</li>
  </ol>
  
  <p>Thus, <code>decltype((a))</code> and <code>decltype(a)&amp;</code> are equivalent in this case, but not always equivalent, for example, if <code>a</code> is not a variable:</p>
  
  <pre><code>typedef decltype((5)) ref_a_type;
  typedef decltype(5)&amp; o_ref_a_type;
  </code></pre>
  
  <p>then both types are not equivalent (<code>ref_a_type</code> is <code>int</code> and <code>o_ref_a_type</code> is <code>int&amp;</code>, since the extra parenthesis are useless in this case). Can someone give a better explanation of this? Should I use the first or the second way?
  IMO it seems more readable and understandable the second way than the first. </p>