<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/language-feature/interfaces/constructor-noncopyable-return.slang, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2024-04-05T23:47:47+00:00</updated>
<entry>
<title>Fix __init() functions that returns an existing value (#3866)</title>
<updated>2024-04-05T23:47:47+00:00</updated>
<author>
<name>sriramm-nv</name>
<email>85252063+sriramm-nv@users.noreply.github.com</email>
</author>
<published>2024-04-05T23:47:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=1b3887f462d01b83690200b9cbcb0dd902b2c0e9'/>
<id>urn:sha1:1b3887f462d01b83690200b9cbcb0dd902b2c0e9</id>
<content type='text'>
Fixes the issue #3671

* The __init constructors are not expected to return a value like other member
  functions, but must construct a new value and return the struct type or none.

* This patch enables this behavior in the IR lowering without complaining about
  illegal situations where the user returns an invalid type or none at all.
   Translate    ordinary struct `return ...;` to `this = ...; return this;`
   Translate NonCopyableType struct `return ...;` to `return this;`

* This patch also fixes the issue with type checking when __init()
  returns a void that mismatches the base type of the struct/ class
   Translate    ordinary struct `return;` to `return this;`
   Translate NonCopyableType struct `return;` to `return;`

* Add end-to-end test and compile only tests to check the above behavior.</content>
</entry>
</feed>
