[LLVMbugs] [Bug 16050] New: Wrong partial specialization used with -Wno-c++11-narrowing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 17 04:51:13 PDT 2013


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

            Bug ID: 16050
           Summary: Wrong partial specialization used with
                    -Wno-c++11-narrowing
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This compiles OK with -std=c++03

typedef unsigned long size_t;

template<class T, size_t N = -1>
struct X
{
    T t[N];
};

template<class T>
struct X<T, -1>
{
    T* t;
};

X<int> x;

But with -std=c++11 -Wno-c++11-narrowing I get:

t.cc:6:9: error: array is too large (18446744073709551615 elements)
    T t[N];
        ^
t.cc:15:8: note: in instantiation of template class 'X<int,
18446744073709551615>' requested here
X<int> x;
       ^
1 error generated.


Shouldn't it behave like -std=c++03 when I disable the diagnostics for
narrowing?

Or at least be consistent in the treatment of the two -1 literals, so the
default template argument of -1 matches the partial specialization's argument
of -1

-- 
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/20130517/59987ee8/attachment.html>


More information about the llvm-bugs mailing list