[Issue 4251] Hole in the const system: immutable values can be overwritten (const(T) is appendable to const(T)[])

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 16 12:27:44 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4251


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at metalanguage.com


--- Comment #10 from Andrei Alexandrescu <andrei at metalanguage.com> 2011-06-16 12:23:01 PDT ---
Yah, this has constantly puzzled starting C++ programmers - you can convert
char* to const(char*) but not char** to const(char*)*.

Generally, consider types P (permissive) and N (nonpermissive). Assume both
types have the same structure, so there is no matter of converting
representation. Generally you can't convert the address of a N to the address
of a P even if you can actually convert a N to an P. This is because the
address conversion would allow you subsequent P-specific operations directly
against an N object.

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


More information about the Digitalmars-d-bugs mailing list