* [Bug c++/109480] g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can.
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
@ 2023-04-12 5:51 ` pinskia at gcc dot gnu.org
2023-04-12 6:02 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-12 5:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Adding:
template <class> friend struct RemoteAccessibleBase;
To the RemoteAccessibleBase template struct fixes the issue ....
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
2023-04-12 5:51 ` [Bug c++/109480] " pinskia at gcc dot gnu.org
@ 2023-04-12 6:02 ` pinskia at gcc dot gnu.org
2023-04-12 6:06 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-12 6:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=41437
Keywords| |rejects-valid
Summary|g++-12 and g++-11 failed to |[11/12/13 Regression]
|compile the attached source |non-depedent access goes
|file while g++-10 and clang |wrong in a template method
|can. |sometimes
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Most likely this was caused by r11-1350 .
Reduced further:
```
template <class> struct s {
protected:
bool g();
void f();
//template <class> friend struct s;
};
template <class d>
void s<d>::f() {
s<int> l;
const bool b = l.g();
}
```
This means also s<int>::f would be the only valid specialization here too.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
2023-04-12 5:51 ` [Bug c++/109480] " pinskia at gcc dot gnu.org
2023-04-12 6:02 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes pinskia at gcc dot gnu.org
@ 2023-04-12 6:06 ` pinskia at gcc dot gnu.org
2023-04-12 6:55 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928 marxin at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-12 6:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (2 preceding siblings ...)
2023-04-12 6:06 ` pinskia at gcc dot gnu.org
@ 2023-04-12 6:55 ` marxin at gcc dot gnu.org
2023-04-12 10:31 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-04-12 6:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-04-12
Summary|[11/12/13 Regression] |[11/12/13 Regression]
|non-depedent access goes |non-depedent access goes
|wrong in a template method |wrong in a template method
|sometimes |sometimes since
| |r11-1350-g92bed036098928
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Most likely this was caused by r11-1350 .
Yes.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (3 preceding siblings ...)
2023-04-12 6:55 ` [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928 marxin at gcc dot gnu.org
@ 2023-04-12 10:31 ` rguenth at gcc dot gnu.org
2023-04-12 12:40 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-12 10:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (4 preceding siblings ...)
2023-04-12 10:31 ` rguenth at gcc dot gnu.org
@ 2023-04-12 12:40 ` ppalka at gcc dot gnu.org
2023-05-07 14:29 ` [Bug c++/109480] [11/12/13/14 " cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-04-12 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13/14 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (5 preceding siblings ...)
2023-04-12 12:40 ` ppalka at gcc dot gnu.org
@ 2023-05-07 14:29 ` cvs-commit at gcc dot gnu.org
2023-05-07 14:30 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-07 14:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:7f4840ddef9746ab591c78ecdd750e3b18aa1ce6
commit r14-556-g7f4840ddef9746ab591c78ecdd750e3b18aa1ce6
Author: Patrick Palka <ppalka@redhat.com>
Date: Sun May 7 10:24:49 2023 -0400
c++: potentiality of templated memfn call [PR109480]
Here we're incorrectly deeming the templated call a.g() inside b's
initializer as potentially constant, despite g being non-constexpr,
which leads to us needlessly instantiating the initializer ahead of time
and which subsequently triggers a bug in access checking deferral (to be
fixed by the follow-up patch).
This patch fixes this by calling get_fns earlier during CALL_EXPR
potentiality checking so that when we extract a FUNCTION_DECL out of a
templated member function call (whose overall callee is typically a
COMPONENT_REF) we do the usual constexpr-eligibility checking for it.
In passing, I noticed the nearby special handling of the object argument
of a non-static member function call is effectively the same as the
generic argument handling a few lines below. So this patch just gets
rid of this special handling; otherwise we'd have to adapt it to handle
templated versions of such calls.
PR c++/109480
gcc/cp/ChangeLog:
* constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
Reorganize to call get_fns sooner. Remove special handling of
the object argument of a non-static member function call. Remove
dead store to 'fun'.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/noexcept59.C: Make e() constexpr so that the
expected "without object" diagnostic isn't replaced by a
"call to non-constexpr function" diagnostic.
* g++.dg/template/non-dependent25.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13/14 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (6 preceding siblings ...)
2023-05-07 14:29 ` [Bug c++/109480] [11/12/13/14 " cvs-commit at gcc dot gnu.org
@ 2023-05-07 14:30 ` cvs-commit at gcc dot gnu.org
2023-05-07 14:31 ` [Bug c++/109480] [11/12/13 " ppalka at gcc dot gnu.org
2023-05-29 10:08 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-07 14:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:681ba2f7681f295a102cd63ffd5ce2b86a5f706e
commit r14-557-g681ba2f7681f295a102cd63ffd5ce2b86a5f706e
Author: Patrick Palka <ppalka@redhat.com>
Date: Sun May 7 10:24:52 2023 -0400
c++: non-dep init folding and access checking [PR109480]
enforce_access currently checks processing_template_decl to decide
whether to defer the given access check until instantiation time.
But using this flag is unreliable because it gets cleared during e.g.
non-dependent initializer folding, and so can lead to premature access
check failures as in the below testcase. It seems better to check
current_template_parms instead.
PR c++/109480
gcc/cp/ChangeLog:
* semantics.cc (enforce_access): Check current_template_parms
instead of processing_template_decl when deciding whether to
defer the access check.
gcc/testsuite/ChangeLog:
* g++.dg/template/non-dependent25a.C: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (7 preceding siblings ...)
2023-05-07 14:30 ` cvs-commit at gcc dot gnu.org
@ 2023-05-07 14:31 ` ppalka at gcc dot gnu.org
2023-05-29 10:08 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-07 14:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13/14 Regression] |[11/12/13 Regression]
|non-depedent access goes |non-depedent access goes
|wrong in a template method |wrong in a template method
|sometimes since |sometimes since
|r11-1350-g92bed036098928 |r11-1350-g92bed036098928
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/109480] [11/12/13 Regression] non-depedent access goes wrong in a template method sometimes since r11-1350-g92bed036098928
2023-04-12 5:38 [Bug c++/109480] New: g++-12 and g++-11 failed to compile the attached source file while g++-10 and clang can ishikawa at yk dot rim.or.jp
` (8 preceding siblings ...)
2023-05-07 14:31 ` [Bug c++/109480] [11/12/13 " ppalka at gcc dot gnu.org
@ 2023-05-29 10:08 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109480
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.4 |11.5
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.
^ permalink raw reply [flat|nested] 11+ messages in thread