www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10149] New: align() expects integer literal

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10149

           Summary: align() expects integer literal
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: turkeyman gmail.com


--- Comment #0 from Manu <turkeyman gmail.com> 2013-05-23 04:39:11 PDT ---
This works fine:
  align(16) int x;

This doesn't:
  enum alignment = 16;
  align(alignment) int x;

Or any other expression for that matter. Can't do:
  align(T.alignof) int x;

This makes some generic code impossible.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10149


Max Samukha <samukha voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com


--- Comment #1 from Max Samukha <samukha voliacable.com> 2013-05-23 09:49:49
PDT ---
dmd has quite a few bugs like that. Your case should be easy to workaround with
a string mixin. Something like:

enum alignment = 16;
mixin("align(" ~ to!string(alignment) ~") int x;");

// or

mixin(format("align(%s) int x;", T.alignof));

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10149


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bearophile_hugs eml.cc
         Resolution|                            |DUPLICATE


--- Comment #2 from bearophile_hugs eml.cc 2013-05-23 09:58:15 PDT ---
*** This issue has been marked as a duplicate of issue 9766 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 23 2013