[Issue 12271] New: Undefined reference linker error with __traits(compiles) that returns false.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Feb 26 17:51:08 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12271
Summary: Undefined reference linker error with
__traits(compiles) that returns false.
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: opantm2+dbugs at gmail.com
--- Comment #0 from Kapps <opantm2+dbugs at gmail.com> 2014-02-26 17:50:47 PST ---
I haven't been able to reduce this further, and while I assume it's the
__traits(compiles) that causes this, I could be wrong.
Note that the __traits(compiles) should always fail.
Sample:
struct Symbol {
}
struct TypeMetadata {
}
void createMetadata(Type)() {
if(__traits(compiles, getType!Type)) { }
}
void getType(T)() {
Symbol = getSymbol!T;
}
Symbol getSymbol(Args...)() {
Symbol result();
return result;
}
void main() {
createMetadata!TypeMetadata;
}
Output:
ogivm:~$ rdmd -v test.d
binary /usr/bin/dmd
version v2.065-devel-0f04b0b
config /usr/bin/dmd.conf
parse test
importall test
import object (/home/kapps/dev/druntime/import/object.di)
semantic test
entry main test.d
semantic2 test
semantic3 test
code test
function D main
function test.createMetadata!(TypeMetadata).createMetadata
function test.getSymbol!(TypeMetadata).getSymbol
gcc /tmp/.rdmd-1000/rdmd-test.d-65EE17DBD03E4141D553B0B773C006B9/objs/test.o -o
/tmp/.rdmd-1000/rdmd-test.d-65EE17DBD03E4141D553B0B773C006B9/test.tmp -m64
-L/usr/lib/x86_64-linux-gnu -L/usr/lib/i386-linux-gnu -Xlinker
--no-warn-search-mismatch -Xlinker --export-dynamic -l:libphobos2.a -lpthread
-lm -lrt
/tmp/.rdmd-1000/rdmd-test.d-65EE17DBD03E4141D553B0B773C006B9/objs/test.o: In
function
`_D4test35__T9getSymbolTS4test12TypeMetadataZ9getSymbolFNaZS4test6Symbol':
test.d:(.text._D4test35__T9getSymbolTS4test12TypeMetadataZ9getSymbolFNaZS4test6Symbol+0x8):
undefined reference to
`_D4test35__T9getSymbolTS4test12TypeMetadataZ9getSymbolFNaZS4test6Symbol6resultMFZS4test6Symbol'
collect2: error: ld returned 1 exit status
--- errorlevel 1
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list