www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6454] New: property doesn't need return type

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

           Summary:  property doesn't need return type
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: simendsjo gmail.com



For  property, the return type is inferred even without the auto return type:

struct S {
     property p() { // missing bool/auto
        return true;
    }
}
void main() {
    S s;
    static assert(is(typeof(s.p) == bool)); // ok
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 08 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6454




This also breaks creation of import files. Notice the double  property:

// D import file generated from 't.d'
struct S
{
     property  property  p()
{
return true;
}
}
void main();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 08 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6454





 For  property, the return type is inferred even without the auto return type:
 
 struct S {
      property p() { // missing bool/auto
         return true;
     }
 }
 void main() {
     S s;
     static assert(is(typeof(s.p) == bool)); // ok
 }
Maybe this is expected feature, but spec does not describe it. http://d-programming-language.org/declaration.html
 Decl:
   StorageClasses Decl
   BasicType Declarators ;
   BasicType Declarator FunctionBody
   AutoDeclaration
 This also breaks creation of import files. Notice the double  property:
 
 // D import file generated from 't.d'
 struct S
 {
      property  property  p()
 {
 return true;
 }
 }
 void main();
This is same as issue 6360. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 21 2011