<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Note in wrong place when using std::enable_if_t"
   href="http://llvm.org/bugs/show_bug.cgi?id=18792">18792</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Note in wrong place when using std::enable_if_t
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++1y
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jonathan.sauer@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following code (enable_if_t is part of C++1y):

template <bool>
struct enable_if { };

template <>
struct enable_if<true> { using type = void; };

template <bool C>
using enable_if_t = typename enable_if<C>::type;

template <typename T, enable_if_t<sizeof(T) == 0>* = nullptr>
//template <typename T, typename enable_if<sizeof(T) == 0>::type* = nullptr>
static void foo()
{
}

int main()
{
  foo<int>();
}


Compiled with clang r201068 this results in:

% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:18:3: error: no matching function for call to 'foo'
  foo<int>();
  ^~~~~~~~
clang.cpp:8:40: note: candidate template ignored: disabled by 'enable_if' [with
T = int]
using enable_if_t = typename enable_if<C>::type;
                                       ^
1 error generated.


While the error is correct, the note is at the wrong place. It should be at
<foo>, not <enable_if_t>, as is the case when enable_if is used directly (see
the commented line):

% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:18:3: error: no matching function for call to 'foo'
  foo<int>();
  ^~~~~~~~
clang.cpp:11:42: note: candidate template ignored: disabled by 'enable_if'
[with T = int]
template <typename T, typename enable_if<sizeof(T) == 0>::type* = nullptr>
                                         ^
1 error generated.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>