[cfe-users] Possible C++ template instantiation bug?
Andreas Schäfer
gentryx at gmx.de
Tue Aug 13 13:50:16 PDT 2013
Dear clang developers,
I was investigating whether our computer simulation library
LibGeoDecomp would work with clang++, when I noticed that some of the
unit tests were failing. Apparently clang++ handles partial
specialization of member function templates in combination with
inheritance differently from other compilers (e.g. g++ and icpc).
I've tried to come up with a minimal test program which reproduces the
odd behavior (attached). Having been pruned so much, the program
itself doesn't make much sense. It was originally part of our code
which handles boundary conditions. IMHO the program should yield the
output "function2" twice, but with clang++ I get "function5" for the
first invocation. Is this a bug in clang++, or is this simply
undefined behavior?
Reproduction:
-------------
icpc test3.cpp -o test && ./test && echo "-------------------------" && g++ test3.cpp -o test && ./test && echo "------------" && clang++ test3.cpp -o test && ./test
Output:
-------
function2
function2
-------------------------
function2
function2
------------
function5
function2
Thanks!
-Andreas
--
==========================================================
Andreas Schäfer
HPC and Grid Computing
Chair of Computer Science 3
Friedrich-Alexander-Universität Erlangen-Nürnberg, Germany
+49 9131 85-27910
PGP/GPG key via keyserver
http://www.libgeodecomp.org
==========================================================
(\___/)
(+'.'+)
(")_(")
This is Bunny. Copy and paste Bunny into your
signature to help him gain world domination!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test3.cpp
Type: text/x-c
Size: 1777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130813/36b5e730/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20130813/36b5e730/attachment.sig>
More information about the cfe-users
mailing list