digitalmars.D.bugs - [Issue 4732] New: __traits(identifier) performs constant folding on symbols
- d-bugmail puremagic.com (36/36) Aug 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4732
- d-bugmail puremagic.com (13/13) Feb 06 2011 http://d.puremagic.com/issues/show_bug.cgi?id=4732
http://d.puremagic.com/issues/show_bug.cgi?id=4732
Summary: __traits(identifier) performs constant folding on
symbols
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: patch, rejects-valid
Severity: minor
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: rsinfu gmail.com
---
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4732
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |clugdbug yahoo.com.au
Resolution| |FIXED
Fixed
https://github.com/D-Programming-Language/dmd/commit/8469bc2f932f7ac93532da8ee454e86e5da3c0e8
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 06 2011








d-bugmail puremagic.com