[LLVMbugs] [Bug 10931] New: clang tries to compile non-instantiated template function
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Sep 15 05:43:19 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10931
Summary: clang tries to compile non-instantiated template
function
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: sbn at tbricks.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
When trying to compile the following simplified C++ source
-----------
struct M;
template <typename T>
void foo(T v)
{
M m(v);
}
int main()
{
return 0;
}
-----------
clang emits error:
-----------
$ /tmp/clang/bootstrap/Release+Asserts/bin/clang++ a.cpp
a.cpp:6:7: error: variable has incomplete type 'M'
M m(v);
^
a.cpp:1:8: note: forward declaration of 'M'
struct M;
^
1 error generated.
$ /tmp/clang/bootstrap/Release+Asserts/bin/clang++ -v
clang version 3.0 (trunk 139788)
Target: x86_64-apple-darwin11.1.0
Thread model: posix
-----------
Although GCC compiles it without any problems:
-----------
$ g++ a.cpp
$ g++ -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure
--disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2
--mandir=/share/man --enable-languages=c,objc,c++,obj-c++
--program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin11
--enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/dst-llvmCore/Developer/usr/local
--program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11
--target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
-----------
System info:
-----------
$ uname -a
Darwin octo 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:09:02 PDT 2011;
root:xnu-1699.22.81~1/RELEASE_I386 i386
-----------
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list