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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to