www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11179] New: Infinite loop when pragma(msg) attempts to print a conflicting symbol

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

           Summary: Infinite loop when pragma(msg) attempts to print a
                    conflicting symbol
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-05
17:13:31 PDT ---
-----
void func(string func = __FUNCTION__)()
{
    // oops, 'func' is also the name of the function
    pragma(msg, func);
}

void test()
{
    func();
}
-----

This makes the compiler start consuming memory without stopping.

The below however is diagnosed properly:

----
void func(string func = "a")()
{
    // oops, 'func' is also the name of the function
    pragma(msg, func);
}

void test()
{
    func();
}
----

test.d(3): Error: function b.func!"a".func circular dependency. Functions
cannot be interpreted while being compiled
test.d(6):        called from here: func()
test.d(6):        while evaluating pragma(msg, func)

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