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

            Bug ID: 19571
           Summary: constexpr variable template in template member
                    function can't be constant expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++1y
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Hi.
I've found a bug related with variable template following yesterday's bug
19558.

constexpr variable template used in template member function can't be a
constant expression.

// Test code
template<class T>
constexpr bool is_pointer = false;

template<class T>
constexpr bool is_pointer<T *> = true;

struct X {
    template<class T>
    void f(){
        static_assert( is_pointer<int *>, "is_pointer<int *>" );
    }
};

int main()
{
    X{}.f<int>();   // Error occurs here
    return 0;
}
// End of test code


Compiler output:
prog.cc:10:24: error: static_assert expression is not an integral constant
expression
        static_assert( is_pointer<int *>, "is_pointer<int *>" );
                       ^~~~~~~~~~~~~~~~~
1 error generated.



I executed above code with clang 3.5 HEAD (trunk 206991) on Linux PC.

http://melpon.org/wandbox/permlink/MgEFu1WBEhMKymbw

-- 
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