www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22053] New: `catch {` not rejected while in a template

https://issues.dlang.org/show_bug.cgi?id=22053

          Issue ID: 22053
           Summary: `catch {` not rejected while in a template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

/////// test.d ///////
void foo()()
{
    try {}
    catch
        assert(false);
}

alias goo = foo!();
//////////////////////

This catch syntax (without specifying an exception) has been deprecated and is
currently rejected when the code is not in a function template. However, the
compiler does not reject it when it's inside a template, even when the template
is instantiated.

--
Jun 20