D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7645 - ICE(e2ir.c) nested classes
Summary: ICE(e2ir.c) nested classes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: ice, pull
: 7701 11621 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-03-04 11:12 UTC by Trass3r
Modified: 2013-11-27 20:04 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Trass3r 2012-03-04 11:12:39 UTC
class Query(string queryText)
{
	class Entity
	{
		void[] buf;

		class fld(T,string varName)
		{
			T opCall()
			{
				return cast(T)buf;
			}
		}
	}
	Entity e;
}
void main()
{
	scope query = new Query!"SELECT ONLY_NEEDED_COLUMNS"
		"FROM contacts c"
		"WHERE c.country = 'US'"
		"AND   c.sales > 10000;";
	
	auto entity = query.e;
	//foreach(entity; query)
	//{
		auto email_addy = entity.fld!(char,"email")();
}

$ dmd test.d 
entity.(fld)
Internal error: e2ir.c 688
Comment 1 Andrej Mitrovic 2012-03-04 11:18:57 UTC
Slightly more reduced:

class Query(string queryText)
{
    class Entity
    {
        void[] buf;

        class fld(T, string varName)
        {
            T opCall()
            {
                return cast(T)buf;
            }
        }
    }
    Entity e;
}

void main()
{
    scope query = new Query!"SELECT ONLY_NEEDED_COLUMNS";
    auto entity = query.e;
    auto email_addy = entity.fld!(char, "email")();
}
Comment 2 Trass3r 2012-03-04 13:36:23 UTC
And more:

class Entity
{
  class fld()
  {
    char t;
  }
}
 
void main()
{
    Entity entity;
    auto email_addy = entity.fld!().t;
}
Comment 3 Denis Shelomovskii 2013-10-14 03:17:49 UTC
*** Issue 7701 has been marked as a duplicate of this issue. ***
Comment 4 Denis Shelomovskii 2013-10-14 03:18:06 UTC
It can be templated `class`, `struct`, or `union`, with function or field.

Testcase from Issue 7701:
---
struct S {
    struct S2 (T) {
        void fn () {}
    }
}

void main () {
    S s;
    s.S2!int.fn();
}
---

Also now internal error is: e2ir.c 780
Comment 6 github-bugzilla 2013-11-18 08:27:16 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/54d6e35d46c7af02dbb718812834e084354c31b5
fix Issue 7645 - ICE(e2ir.c) nested classes

https://github.com/D-Programming-Language/dmd/commit/346988f858702f958e559f7c28d4cb92f87e0eb7
Merge pull request #2818 from 9rnsr/fix7645

Issue 7645 - ICE(e2ir.c) nested classes
Comment 7 Kenji Hara 2013-11-27 20:04:23 UTC
*** Issue 11621 has been marked as a duplicate of this issue. ***