Summary: __traits(identifier) performs constant folding on
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: patch, rejects-valid
          Severity: minor
          Priority: P2
         Component: DMD

--- Comment #0 from Shin Fujishiro <> 2010-08-26 12:13:50 PDT 
Created an attachment (id=741)
Patch against dmd r621

__traits(identifier) tries to fold its argument to a constant. And symbols of
manifest constants cannot be obtained via the traits:
-------------------- test.d
enum symbol = 42;
pragma(msg, __traits(identifier, symbol), " = ", symbol);
% dmd -c -o- test
test.d(2): Error: argument 42 has no identifier
false = 42

For the 'identifier' traits, folding an argument to a constant does not make
sense. The proposed patch fixes the problem by disabling constfold on arguments
as done in the 'isSame' traits.

With the patch, the result gets corrected:

% dmd-patched -c -o- test
symbol = 42

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to