Thread overview
[Issue 23259] Visibility entirely ignored by the compiler
[Issue 23259] Visibility violation with variadic templates
Jul 19, 2022
LucienPe
Jul 19, 2022
LucienPe
Jul 19, 2022
LucienPe
[Issue 23259] Visibility violation with variadic templates
Jul 19, 2022
LucienPe
Jul 19, 2022
LucienPe
Aug 14, 2022
LucienPe
Dec 17, 2022
Iain Buclaw
July 19, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

LucienPe <lucien.perregaux@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3
           Severity|normal                      |regression

--- Comment #1 from LucienPe <lucien.perregaux@gmail.com> ---
In fact, the bug has nothing to do with templates, the visibility is totally ignored :

```
class C { private int h = 8; }

void main()
{
    C c = new C();
    writeln(c.h); // compiles
}
```

--
July 19, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

LucienPe <lucien.perregaux@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
            Summary|Visibility violation with   |Visibility entirely ignored
                   |variadic templates          |by the compiler

--
July 19, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

--- Comment #2 from LucienPe <lucien.perregaux@gmail.com> ---
(In reply to LucienPe from comment #1)
> In fact, the bug has nothing to do with templates, the visibility is totally ignored :
> 
> ```
> class C { private int h = 8; }
> 
> void main()
> {
>     C c = new C();
>     writeln(c.h); // compiles
> }
> ```

Nevermind, the DIP states "Private class members are, technically, private module members".

However, this example is still (in)valid :

main.d:
```
module main;

import c;
import std.stdio;

void main()
{
        auto c = new C!string(8);
        //writeln(c.h);
        c.f!string(8);
}
```

c.d:
```
module c;

import std.stdio;

class C(T, Args...)
{
private:
        this(int i, Args args)
        {
                string str = "private ctor should not be called !";
                writeln(str);
                //assert(0, str);
        }

        void f(U, V...)(int i, V v)
        {
                string str = "private function should not be called !";
                writeln(str);
                //assert(0, str);
        }
public:
        this(Args args)
        {
                writeln("public ctor should be called !");
        }

        void f(V...)(V v)
        {
                writeln("public function should be called !");
        }
}
```

and produces:
```
private ctor should not be called !
private function should not be called !
```

--
July 19, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

LucienPe <lucien.perregaux@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Visibility entirely ignored |Visibility violation with
                   |by the compiler             |variadic templates

--
July 19, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

LucienPe <lucien.perregaux@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lucien.perregaux@gmail.com

--
August 14, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

LucienPe <lucien.perregaux@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|regression                  |normal

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23259

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 13
https://issues.dlang.org/show_bug.cgi?id=23259

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/20130

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--