public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected
@ 2023-02-19 19:53 eric.niebler at gmail dot com
2023-02-20 19:14 ` [Bug c++/108848] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: eric.niebler at gmail dot com @ 2023-02-19 19:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Bug ID: 108848
Summary: Accessing class static member of non-dependent
expression using member syntax in dependent context is
rejected
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: eric.niebler at gmail dot com
Target Milestone: ---
Clang accepts the following, gcc thinks the expression in the line marked
"HERE" should be `tag<int>.template smbr<void>`.
template <class T>
struct tag_t {
template <class Sig>
static constexpr const Sig* smbr = nullptr;
int i = 0;
};
template <class T>
inline constexpr tag_t<T> tag {};
// This is OK
using X = decltype(tag<int>.smbr<void>);
template <class U>
struct S {
// This is incorrectly rejected by gcc
using Y = decltype(tag<int>.smbr<void>);
// This is OK
using Z = decltype(tag_t<int>::smbr<void>);
};
https://godbolt.org/z/9GoPYTYa1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
@ 2023-02-20 19:14 ` pinskia at gcc dot gnu.org
2023-02-21 1:33 ` [Bug c++/108848] [10/11/12/13 Regression] " ppalka at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-20 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-02-20
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=67965
Ever confirmed|0 |1
Summary|Accessing class static |template keyword
|member of non-dependent |incorreclty required to
|expression using member |access template class
|syntax in dependent context |static member of
|is rejected |non-dependent expression
| |using member syntax in
| |dependent context
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase to show it is not an issue with decltype:
template <class T>
struct tag_t {
template <class Sig>
static constexpr const Sig* smbr = nullptr;
};
template <class T>
inline constexpr tag_t<T> tag {};
template<class T>
void f()
{
auto t = tag<int>.smbr<void>;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [10/11/12/13 Regression] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
2023-02-20 19:14 ` [Bug c++/108848] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context pinskia at gcc dot gnu.org
@ 2023-02-21 1:33 ` ppalka at gcc dot gnu.org
2023-02-21 12:27 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-21 1:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
Summary|template keyword |[10/11/12/13 Regression]
|incorreclty required to |template keyword
|access template class |incorreclty required to
|static member of |access template class
|non-dependent expression |static member of
|using member syntax in |non-dependent expression
|dependent context |using member syntax in
| |dependent context
Known to work| |5.1.0
Known to fail| |10.4.0, 11.3.0, 12.2.0,
| |13.0, 5.2.0
Target Milestone|--- |10.5
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Testcase exhibiting a regression relative to GCC 5.1:
template <class T>
struct tag_t {
template <class Sig>
static const Sig* smbr();
};
template <class T>
constexpr tag_t<T> tag {};
template<class T>
void f()
{
auto t = tag<int>.smbr<void>();
}
Started with r226642.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [10/11/12/13 Regression] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
2023-02-20 19:14 ` [Bug c++/108848] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context pinskia at gcc dot gnu.org
2023-02-21 1:33 ` [Bug c++/108848] [10/11/12/13 Regression] " ppalka at gcc dot gnu.org
@ 2023-02-21 12:27 ` rguenth at gcc dot gnu.org
2023-02-23 17:01 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 12:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [10/11/12/13 Regression] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
` (2 preceding siblings ...)
2023-02-21 12:27 ` rguenth at gcc dot gnu.org
@ 2023-02-23 17:01 ` ppalka at gcc dot gnu.org
2023-02-28 20:05 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-23 17:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [10/11/12/13 Regression] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
` (3 preceding siblings ...)
2023-02-23 17:01 ` ppalka at gcc dot gnu.org
@ 2023-02-28 20:05 ` cvs-commit at gcc dot gnu.org
2023-02-28 20:06 ` [Bug c++/108848] [10/11/12 " ppalka at gcc dot gnu.org
2023-07-07 10:44 ` [Bug c++/108848] [11/12 Regression] template keyword incorrectly " rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-28 20:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
--- Comment #3 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:d3d205ab440886164b6de2be2a2efa10cac95b66
commit r13-6380-gd3d205ab440886164b6de2be2a2efa10cac95b66
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Feb 28 15:05:30 2023 -0500
c++: non-dependent variable template-id [PR108848]
Here we're treating deeming the non-dependent variable template-id
tag<int> as dependent ever since r226642 gave variable TEMPLATE_ID_EXPR
an empty type, which causes the call to finish_template_variable from
finish_id_expression_1 to be unreachable at template parse time. Thus
we're led into thinking tag<int>.var<void> refers to a dependent name.
This patch fixes this by making finish_id_expression_1 instantiate a
variable template-id as long as it's not dependent according to the
dependence test in lookup_and_finish_template_variable rather than
according to type_dependent_expression_p.
PR c++/108848
gcc/cp/ChangeLog:
* pt.cc (finish_template_variable): Move dependence check
to here from ...
(lookup_and_finish_template_variable): ... here.
* semantics.cc (finish_id_expression_1): Call
finish_template_variable sooner, before (and regardless of) the
type_dependent_expression_p test.
gcc/testsuite/ChangeLog:
* g++.dg/cpp1y/noexcept1.C: Don't expect a bogus "different
exception specifier" error. Expect a separate "not usable
in a constant expression" error.
* g++.dg/cpp1y/var-templ75.C: New test.
* g++.dg/cpp1y/var-templ76.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [10/11/12 Regression] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
` (4 preceding siblings ...)
2023-02-28 20:05 ` cvs-commit at gcc dot gnu.org
@ 2023-02-28 20:06 ` ppalka at gcc dot gnu.org
2023-07-07 10:44 ` [Bug c++/108848] [11/12 Regression] template keyword incorrectly " rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-02-28 20:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |13.0
Known to fail|13.0 |
Summary|[10/11/12/13 Regression] |[10/11/12 Regression]
|template keyword |template keyword
|incorreclty required to |incorreclty required to
|access template class |access template class
|static member of |static member of
|non-dependent expression |non-dependent expression
|using member syntax in |using member syntax in
|dependent context |dependent context
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13 so far
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108848] [11/12 Regression] template keyword incorrectly required to access template class static member of non-dependent expression using member syntax in dependent context
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
` (5 preceding siblings ...)
2023-02-28 20:06 ` [Bug c++/108848] [10/11/12 " ppalka at gcc dot gnu.org
@ 2023-07-07 10:44 ` rguenth at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108848
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-07-07 10:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-19 19:53 [Bug c++/108848] New: Accessing class static member of non-dependent expression using member syntax in dependent context is rejected eric.niebler at gmail dot com
2023-02-20 19:14 ` [Bug c++/108848] template keyword incorreclty required to access template class static member of non-dependent expression using member syntax in dependent context pinskia at gcc dot gnu.org
2023-02-21 1:33 ` [Bug c++/108848] [10/11/12/13 Regression] " ppalka at gcc dot gnu.org
2023-02-21 12:27 ` rguenth at gcc dot gnu.org
2023-02-23 17:01 ` ppalka at gcc dot gnu.org
2023-02-28 20:05 ` cvs-commit at gcc dot gnu.org
2023-02-28 20:06 ` [Bug c++/108848] [10/11/12 " ppalka at gcc dot gnu.org
2023-07-07 10:44 ` [Bug c++/108848] [11/12 Regression] template keyword incorrectly " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).