<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 --- - Partially specialized constexpr variable template can't be used in a constant expression"
   href="http://llvm.org/bugs/show_bug.cgi?id=20029">20029</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Partially specialized constexpr variable template can't be used in a constant expression
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Keywords</th>
          <td>compile-fail
          </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>ldionne.2@gmail.com
          </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>Created <span class=""><a href="attachment.cgi?id=12655" name="attach_12655" title="Test code to reproduce error with comments">attachment 12655</a> <a href="attachment.cgi?id=12655&action=edit" title="Test code to reproduce error with comments">[details]</a></span>
Test code to reproduce error with comments

Hi,

The following code does not compile with Clang r210819:
------------------------------------------------------------------------------
template <int i>
struct Foo;

template <typename T>
constexpr bool predicate = true;

template <typename T, bool = predicate<T>>
struct test { };

template struct test<Foo<0>>;
------------------------------------------------------------------------------

The error message is:
------------------------------------------------------------------------------
/Users/ldionne/code/hana/test/sandbox/worksheet.cpp:18:30: error: non-type
template argument is not a constant expression
template <typename T, bool = predicate<T>>
                             ^
/Users/ldionne/code/hana/test/sandbox/worksheet.cpp:21:28: note: while checking
a default template argument used here
template struct test<Foo<0>>;
                ~~~~~~~~~~~^
1 error generated.
------------------------------------------------------------------------------

The exact command line is:
~/code/llvm-git/build/bin/clang -std=c++1y -fsyntax-only
~/code/hana/test/sandbox/worksheet.cpp

I think this is related to 19571. I also attached a version of the above test 
code with a couple of comments showing things I've tried.


Regards,
Louis Dionne</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>