[Issue 1777] New: Allow atomic types in typeof() or improve error message

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 10 04:45:01 PST 2008


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

           Summary: Allow atomic types in typeof() or improve error message
           Product: D
           Version: 2.009
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: aarti at interia.pl


Currently first assert compiles, but the second one not:

void main() {
    class A {}
    static assert(is( typeof(new A) == typeof(A)) ); // 1
    static assert(is( typeof(new int*) == typeof(int*) )); // 2
}

I propose for consistancy to:
1. Allow typeof to take also atomic types.
2. Improve error message when compiler fails. Currently:
   quicktest.d(62): found '*' when expecting '.' following 'int'
   quicktest.d(62): found ')' when expecting identifier following 'int.'
   quicktest.d(62): found ';' when expecting ')'
   quicktest.d(64): found '}' when expecting ';'
   quicktest.d(65): found 'EOF' instead of statement
   quicktest.d(65): found 'EOF' instead of statement
   quicktest.d(65): found 'EOF' instead of statement 

Whole thread with rationale:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=10679



More information about the Digitalmars-d-bugs mailing list