[LLVMbugs] [Bug 19571] New: constexpr variable template in template member function can't be constant expression

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Apr 26 06:42:56 PDT 2014


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: unassignedclangbugs at nondot.org
          Reporter: lin90162 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140426/653c7c67/attachment.html>


More information about the llvm-bugs mailing list