http://llvm.org/bugs/show_bug.cgi?id=20029

            Bug ID: 20029
           Summary: Partially specialized constexpr variable template
                    can't be used in a constant expression
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 12655
  --> http://llvm.org/bugs/attachment.cgi?id=12655&action=edit
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to