www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21269] New: ReplaceType on function type does not compile

https://issues.dlang.org/show_bug.cgi?id=21269

          Issue ID: 21269
           Summary: ReplaceType on function type does not compile with
                    -betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: snarwin+bugzilla gmail.com

Example:

---
import std.typecons: ReplaceType;
alias F = ReplaceType!(int, double, int function());
---

Compiler output:

---
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(8958): Error: TypeInfo
cannot be used with -betterC
---

The cause of this error is the private helper template
replaceTypeInFunctionTypeUnless, which uses the `~=` operator in CTFE. Due to
issue 19268, this causes compilation to fail.

--
Sep 22 2020