http://llvm.org/bugs/show_bug.cgi?id=15265
Bug ID: 15265
Summary: C++98/03: Use of unnamed type fails to remove
candidate
Product: clang
Version: 3.2
Hardware: PC
OS: other
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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
[-Wunnamed-type-template-args]
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
type
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs