Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed function prototype handling of original function type syntax in…
… code generation (modified IR to support added type_syntax, but only for function declarations at this point).
- Loading branch information
1 parent
1f1e7bf
commit bb3a5ef
Showing
7 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule EDG
updated
from 52cf9c to 2fa353
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ namespace | |
const unsigned array_size = 3; | ||
} | ||
|
||
#if 1 | ||
void foo( int reverse_boundary[array_size] ) | ||
{ | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
void foo(int a[1]); // size is irrelevant | ||
void bar(int(&a)[1]); // size is irrelevant | ||
void baz(int(*a)[1]); // size is irrelevant | ||
|
||
namespace | ||
{ | ||
const unsigned array_size = 3; | ||
const unsigned array_size2 = 2; | ||
} | ||
|
||
/* | ||
C++ '03 8.3.5/3: ...The type of a function is determined using the | ||
following rules. The type of each parameter is determined from its | ||
own decl-specifier-seq and declarator. After determining the type | ||
of each parameter, any parameter of type "array of T" or "function | ||
returning T" is adjusted to be "pointer to T" or "pointer to | ||
function returning T," respectively.... | ||
*/ | ||
|
||
void foo(int a[array_size]) { // decays to a pointer and becomes int* (C inheritage) | ||
a[0]=a[1]+1; | ||
} | ||
|
||
void bar(int(&a)[array_size2]) { // size is enforced | ||
a[0]=a[1]+1; | ||
} | ||
|
||
void baz(int(*a)[array_size2]) { // size is enforced | ||
(*a)[0]=(*a)[1]+1; | ||
} | ||
|
||
int main() { | ||
int a[2]; | ||
a[1]=1; | ||
foo(a); | ||
bar(a); | ||
baz(&a); | ||
return 0; | ||
} |