[LLVMbugs] [Bug 16851] New: Templates in Microsoft Mode do not allow casting from one type to another

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 9 12:30:54 PDT 2013


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

            Bug ID: 16851
           Summary: Templates in Microsoft Mode do not allow casting from
                    one type to another
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

We should allow the following but we do not:
template <const void *>
struct foo {
};

extern const int x;
foo<(const void *)&x> a;
foo<&x> b;
foo<((const void *)&x)> c;

instead, we claim:
<stdin>:6:5: error: non-type template argument does not refer to any
declaration
foo<(const void *)&x> a;
    ^~~~~~~~~~~~~~~~
<stdin>:1:23: note: template parameter is declared here
template <const void *>
                      ^
<stdin>:7:6: error: non-type template argument of type 'const int *' cannot be
converted to a value of type 'const void *'
foo<&x> b;
     ^
<stdin>:1:23: note: template parameter is declared here
template <const void *>
                      ^
<stdin>:8:5: warning: address non-type template argument cannot be surrounded
by parentheses
foo<((const void *)&x)> c;
    ^~~~~~~~~~~~~~~~~~
<stdin>:8:6: error: non-type template argument does not refer to any
declaration
foo<((const void *)&x)> c;
     ^~~~~~~~~~~~~~~~
<stdin>:1:23: note: template parameter is declared here
template <const void *>
                      ^
1 warning and 3 errors generated

-- 
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/20130809/71c9cbdc/attachment.html>


More information about the llvm-bugs mailing list