# HG changeset patch # User Frank Benoit # Date 1223396008 -7200 # Node ID 68adc3a367d9dbaac4429e2f268c470b62b7fc25 # Parent 174bd206cf10be427449b27edf748b2af5dfc05a Better static asserts to detect changing .stringof format diff -r 174bd206cf10 -r 68adc3a367d9 dwt/internal/gtk/OS.d --- a/dwt/internal/gtk/OS.d Tue Oct 07 17:50:07 2008 +0200 +++ b/dwt/internal/gtk/OS.d Tue Oct 07 18:13:28 2008 +0200 @@ -616,12 +616,18 @@ template NameOfFunc(alias f) { // Note: highly dependent on the .stringof formatting // the value begins with "& " which is why the first two chars are cut off + + // this is also used in dwt/internal/cairo/Cairo and dwt/internal/accessible/gtk/ATK version( LDC ){ - // stringof in LLVMDC is "&foobar" + // stringof in LDC is "&foobar" + static assert( (&f).stringof[0] == '&' ); + static assert( (&f).stringof[1] != ' ' ); const char[] NameOfFunc = (&f).stringof[1 .. $]; } else{ // stringof in DMD is "& foobar" + static assert( (&f).stringof[0] == '&' ); + static assert( (&f).stringof[1] == ' ' ); const char[] NameOfFunc = (&f).stringof[2 .. $]; } }