[Issue 3175] rejects templated ref return function

2015-06-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3175

Andrei Alexandrescu and...@erdani.com changed:

   What|Removed |Added

Version|2.031   |D2

--


[Issue 3175] rejects templated ref return function

2010-11-23 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||clugd...@yahoo.com.au
 Resolution||FIXED


--- Comment #6 from Don clugd...@yahoo.com.au 2010-11-23 05:15:10 PST ---
(In reply to comment #5)
 (In reply to comment #4)
  Applied the patch http://www.dsource.org/projects/dmd/changeset/695 but the 
  bug
  remains.
 
 Are you saying the bug remains since the reproducing code in comment #0 
 doesn't
 compile? It's because the type of [1,2,3] has changed to dynamic int[].
 Replacing 'auto' to 'int[3]' would make it compile.

Indeed it does work in DMD2.050.

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


[Issue 3175] rejects templated ref return function

2010-09-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com


--- Comment #4 from Walter Bright bugzi...@digitalmars.com 2010-09-27 
19:35:27 PDT ---
Applied the patch http://www.dsource.org/projects/dmd/changeset/695 but the bug
remains.

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


[Issue 3175] rejects templated ref return function

2010-09-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175



--- Comment #5 from Shin Fujishiro rsi...@gmail.com 2010-09-27 21:00:38 PDT 
---
(In reply to comment #4)
 Applied the patch http://www.dsource.org/projects/dmd/changeset/695 but the 
 bug
 remains.

Are you saying the bug remains since the reproducing code in comment #0 doesn't
compile? It's because the type of [1,2,3] has changed to dynamic int[].
Replacing 'auto' to 'int[3]' would make it compile.

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


[Issue 3175] rejects templated ref return function

2010-09-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175


Shin Fujishiro rsi...@gmail.com changed:

   What|Removed |Added

   Keywords||patch
   Severity|trivial |major


--- Comment #3 from Shin Fujishiro rsi...@gmail.com 2010-09-25 18:16:35 PDT 
---
Patch against dmd r687. deduceFunctionTemplateMatch() must reset storage class
in parameter's scope as done in matchWithInstance().

--- a/src/template.c
+++ b/src/template.c
@@ -887,6 +887,7 @@ MATCH
TemplateDeclaration::deduceFunctionTemplateMatch(Scope *sc, Loc loc, Objec
 ScopeDsymbol *paramsym = new ScopeDsymbol();
 paramsym-parent = scope-parent;
 Scope *paramscope = scope-push(paramsym);
+paramscope-stc = 0;

 TemplateTupleParameter *tp = isVariadic();
 int tp_is_declared = 0;


Increased the severity as the bug has been repeatedly reported: bug 4041, bug
4446, bug 4934 and comment 2 of bug 2460.

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


[Issue 3175] rejects templated ref return function

2010-09-20 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175


Shin Fujishiro rsi...@gmail.com changed:

   What|Removed |Added

 CC||rsi...@gmail.com


--- Comment #2 from Shin Fujishiro rsi...@gmail.com 2010-09-20 22:03:05 PDT 
---
*** Issue 4446 has been marked as a duplicate of this issue. ***

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


[Issue 3175] rejects templated ref return function

2009-11-18 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3175


Luther Tychonievich la...@virginia.edu changed:

   What|Removed |Added

 CC||la...@virginia.edu
   Severity|normal  |trivial


--- Comment #1 from Luther Tychonievich la...@virginia.edu 2009-11-18 
10:30:44 PST ---
This is only a problem with template parameter deduction:

ref int foo(int x)(int[x] v) if (x0) { return v[0]; }

foo!(2)([1,2]); // works
foo([1,2]); // gives only parameters or foreach... error message


It can be sidestepped by explicit template declaration:

template foo(int x) if (x0) {
ref int foo(int[x] v) { return v[0]; }
}

foo([1,2]); // works


While obviously not as nice as function template syntax, this workaround is not
difficult to read or write and contains full functionality.


I posit the error message is wrong either way: declarations.c line 908 should
read:
error(only function return types, parameters, and foreach declarations can
be ref);

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