[LLVMbugs] [Bug 15265] New: C++98/03: Use of unnamed type fails to remove candidate

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 13 20:49:11 PST 2013


            Bug ID: 15265
           Summary: C++98/03: Use of unnamed type fails to remove
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: other
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

As per Bug 6784, unnamed types cannot be used as template arguments under
C++98/03. It appears that the result of the work done in the aforementioned bug
is to emit a warning.

The warning is not sufficient. In the small test case below, the incorrect
overload candidate is chosen by clang but not GCC.

### SOURCE:$ cat sfinaeOnTypeLinkage.cc
typedef enum { EE } *PtrE;

template <typename T>
char (*foo(T))[13];

char (*foo(void *))[42];

extern char check[sizeof *foo(PtrE(0))];
extern char check[42];

### ACTUAL:$ clang++ '-std=c++03' sfinaeOnTypeLinkage.cc -c && \
  echo "(Clean compile)"
sfinaeOnTypeLinkage.cc:8:27: warning: template argument uses unnamed type
extern char check[sizeof *foo(PtrE(0))];
sfinaeOnTypeLinkage.cc:1:9: note: unnamed type used in template argument was
declared here
typedef enum { EE } *PtrE;
sfinaeOnTypeLinkage.cc:9:13: error: redefinition of 'check' with a different
extern char check[42];
sfinaeOnTypeLinkage.cc:8:13: note: previous definition is here
extern char check[sizeof *foo(PtrE(0))];
1 warning and 1 error generated.

### EXPECTED:$ g++ '-std=c++98' sfinaeOnTypeLinkage.cc -c && \
  echo "(Clean compile)"
(Clean compile)

### BUILD INFORMATION:$ clang -v
clang version 3.2 (trunk 158227)
Target: i386-pc-cygwin
Thread model: posix

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/20130214/c2dc7a47/attachment.html>

More information about the llvm-bugs mailing list