September 27, 2014
https://issues.dlang.org/show_bug.cgi?id=13539

          Issue ID: 13539
           Summary: Disallow optional template parameters with C-style
                    syntax
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody@puremagic.com
          Reporter: k.hara.pg@gmail.com

When I improved DIP42 feature, I didn't consider the combination with C-style syntax.

https://github.com/D-Programming-Language/dmd/pull/2368 https://github.com/D-Programming-Language/dlang.org/pull/371

Current grammar accepts the optional template parameters always, even if the DeclaratorSuffixes is not empty.

Declarator:
    BasicType2_opt ( Declarator ) DeclaratorSuffixes_opt
    BasicType2_opt Identifier DeclaratorSuffixes_opt

[snip]

DeclaratorSuffix:
    [ ]
    [ AssignExpression ]
    [ Type ]
    Parameters MemberFunctionAttributes_opt
    TemplateParameters Parameters MemberFunctionAttributes_opt Constraint_opt

Because of the fact, current dmd accepts follwing syntax.

string results[](T) = "I have no idea what I'm doing";

It was mentioned in the thread: http://forum.dlang.org/post/kjodgiflvnqaazyyawsm@forum.dlang.org

I think we need to disallow such syntax to recommend proper D style declaration.

--