mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Fix Bugzilla 24387 - Base class construction ignores private (#16180)
* Fix Bugzilla 24387 - Base class construction ignores private * Fix access checks for ctor overloads
This commit is contained in:
parent
e367663549
commit
39dffd8e5f
3 changed files with 23 additions and 3 deletions
|
@ -5023,7 +5023,12 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
|||
return setError();
|
||||
|
||||
checkFunctionAttributes(exp, sc, f);
|
||||
checkAccess(cd, exp.loc, sc, f);
|
||||
if (!checkSymbolAccess(sc, f))
|
||||
{
|
||||
error(exp.loc, "%s `%s` is not accessible from module `%s`",
|
||||
f.kind(), f.toPrettyChars(), sc._module.toChars);
|
||||
return setError();
|
||||
}
|
||||
|
||||
TypeFunction tf = f.type.isTypeFunction();
|
||||
if (!exp.arguments)
|
||||
|
@ -6463,7 +6468,12 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
|
|||
return setError();
|
||||
|
||||
checkFunctionAttributes(exp, sc, exp.f);
|
||||
checkAccess(exp.loc, sc, null, exp.f);
|
||||
if (!checkSymbolAccess(sc, exp.f))
|
||||
{
|
||||
error(exp.loc, "%s `%s` is not accessible from module `%s`",
|
||||
exp.f.kind(), exp.f.toPrettyChars(), sc._module.toChars);
|
||||
return setError();
|
||||
}
|
||||
|
||||
exp.e1 = new DotVarExp(exp.e1.loc, exp.e1, exp.f, false);
|
||||
exp.e1 = exp.e1.expressionSemantic(sc);
|
||||
|
|
|
@ -3,4 +3,5 @@ module issue21685;
|
|||
class E
|
||||
{
|
||||
private this() {}
|
||||
public this(int) {}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* REQUIRED_ARGS: -preview=dip1000 -Ifail_compilation/imports
|
||||
TEST_OUTPUT:
|
||||
---
|
||||
fail_compilation/issue21685_main.d(11): Error: class `issue21685.E` constructor `this` is not accessible
|
||||
fail_compilation/issue21685_main.d(12): Error: constructor `issue21685.E.this` is not accessible from module `issue21685_main`
|
||||
fail_compilation/issue21685_main.d(19): Error: constructor `issue21685.E.this` is not accessible from module `issue21685_main`
|
||||
---
|
||||
*/
|
||||
import issue21685;
|
||||
|
@ -10,3 +11,11 @@ void main()
|
|||
{
|
||||
new E;
|
||||
}
|
||||
|
||||
class F : E
|
||||
{
|
||||
this()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue