public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'"
@ 2022-05-26 4:30 llvm at rifkin dot dev
2022-05-26 4:46 ` [Bug c++/105734] " llvm at rifkin dot dev
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: llvm at rifkin dot dev @ 2022-05-26 4:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Bug ID: 105734
Summary: Regression: Incorrect "error: invalid use of 'auto'"
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: llvm at rifkin dot dev
Target Milestone: ---
The following code errors erroneously: https://godbolt.org/z/68vYYj8cc
A more minimal reproducible example is here: https://godbolt.org/z/f75Yx7K57.
Interestingly the error only manifests in conjunction with the explicit
destructor call.
This came up in conjunction with a library doing a lot of TMP shenanigans, I
will try to make a more minimal standalone reproducible example.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] Regression: Incorrect "error: invalid use of 'auto'"
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
@ 2022-05-26 4:46 ` llvm at rifkin dot dev
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: llvm at rifkin dot dev @ 2022-05-26 4:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #1 from Jeremy R. <llvm at rifkin dot dev> ---
More minimal: https://godbolt.org/z/WcGab4W8T
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] Regression: Incorrect "error: invalid use of 'auto'"
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
2022-05-26 4:46 ` [Bug c++/105734] " llvm at rifkin dot dev
@ 2022-05-26 5:03 ` pinskia at gcc dot gnu.org
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-26 5:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
namespace hh {
struct nothing {};
template<typename A = int>
struct expression_decomposer {
auto h() {
return expression_decomposer<bool>();
}
};
}
template <typename T>
void bar() {
auto m = hh::expression_decomposer( hh::expression_decomposer{}.h());
m.~expression_decomposer();
}
void foo() { bar<int>(); }
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] Regression: Incorrect "error: invalid use of 'auto'"
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
2022-05-26 4:46 ` [Bug c++/105734] " llvm at rifkin dot dev
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
@ 2022-05-26 5:03 ` pinskia at gcc dot gnu.org
2022-05-26 5:05 ` [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template pinskia at gcc dot gnu.org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-26 5:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Reduced testcase:
> namespace hh {
> struct nothing {};
> template<typename A = int>
> struct expression_decomposer {
> auto h() {
> return expression_decomposer<bool>();
> }
> };
> }
>
> template <typename T>
> void bar() {
> auto m = hh::expression_decomposer( hh::expression_decomposer{}.h());
> m.~expression_decomposer();
> }
>
> void foo() { bar<int>(); }
The namespace is really required here. If I remove it, it works ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (2 preceding siblings ...)
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
@ 2022-05-26 5:05 ` pinskia at gcc dot gnu.org
2022-05-26 5:07 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-26 5:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.2
Summary|Regression: Incorrect |[12/13 Regression]:
|"error: invalid use of |Incorrect "error: invalid
|'auto'" |use of 'auto'" for explicit
| |destructor inside a
| |template
Known to fail| |12.1.0
Known to work| |11.3.0
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-05-26
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (3 preceding siblings ...)
2022-05-26 5:05 ` [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template pinskia at gcc dot gnu.org
@ 2022-05-26 5:07 ` pinskia at gcc dot gnu.org
2022-05-26 5:09 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-26 5:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jeremy R. from comment #1)
> More minimal: https://godbolt.org/z/WcGab4W8T
>// only fails when this stuff is in a namespace, for some reason
You found that at the same time I did :).
Here is the most reduced testcase changing the names some more:
namespace hh {
struct nothing {};
template<typename A = int>
struct s {
auto h() {
return s<bool>();
}
};
}
template <typename T>
void bar() {
auto m = hh::s( hh::s{}.h());
m.~s();
}
void foo() { bar<int>(); }
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (4 preceding siblings ...)
2022-05-26 5:07 ` pinskia at gcc dot gnu.org
@ 2022-05-26 5:09 ` pinskia at gcc dot gnu.org
2022-05-26 7:42 ` redi at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-05-26 5:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A little more reduced:
namespace hh {
struct nothing {};
template<int = 1>
struct s {
s h();
};
}
template <int>
void bar() {
auto m = hh::s(hh::s{}.h());
m.~s();
}
void foo() { bar<1>(); }
The template arguments can be the same even.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (5 preceding siblings ...)
2022-05-26 5:09 ` pinskia at gcc dot gnu.org
@ 2022-05-26 7:42 ` redi at gcc dot gnu.org
2022-05-26 7:59 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-26 7:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jeremy R. from comment #1)
> More minimal: https://godbolt.org/z/WcGab4W8T
The https://gcc.gnu.org/bugs very clearly says to provide the testcase *here*
not only as a URL.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (6 preceding siblings ...)
2022-05-26 7:42 ` redi at gcc dot gnu.org
@ 2022-05-26 7:59 ` redi at gcc dot gnu.org
2022-05-26 15:34 ` llvm at rifkin dot dev
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-26 7:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Regression started with r12-3643
c++: improve lookup of member-qualified names
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (7 preceding siblings ...)
2022-05-26 7:59 ` redi at gcc dot gnu.org
@ 2022-05-26 15:34 ` llvm at rifkin dot dev
2022-05-27 2:32 ` llvm at rifkin dot dev
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: llvm at rifkin dot dev @ 2022-05-26 15:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #9 from Jeremy R. <llvm at rifkin dot dev> ---
(In reply to Jonathan Wakely from comment #7)
> (In reply to Jeremy R. from comment #1)
> > More minimal: https://godbolt.org/z/WcGab4W8T
>
> The https://gcc.gnu.org/bugs very clearly says to provide the testcase
> *here* not only as a URL.
Thanks for letting me know
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (8 preceding siblings ...)
2022-05-26 15:34 ` llvm at rifkin dot dev
@ 2022-05-27 2:32 ` llvm at rifkin dot dev
2022-05-27 6:27 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: llvm at rifkin dot dev @ 2022-05-27 2:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #10 from Jeremy R. <llvm at rifkin dot dev> ---
One workaround in the general case is
decltype(ns::expression_decomposer(ns::expression_decomposer{} << expr)) =
libassert_decomposer = ns::expression_decomposer(ns::expression_decomposer{} <<
expr);
But this doesn't work if expr is a lambda.
A more general workaround is deferring the destructor to another function:
template<typename T> void destruct(T& t) {
t.~T();
}
template <int>
void bar() {
auto m = hh::s(hh::s{}.h());
destruct(m);
}
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (9 preceding siblings ...)
2022-05-27 2:32 ` llvm at rifkin dot dev
@ 2022-05-27 6:27 ` rguenth at gcc dot gnu.org
2022-05-31 20:25 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 6:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (10 preceding siblings ...)
2022-05-27 6:27 ` rguenth at gcc dot gnu.org
@ 2022-05-31 20:25 ` jason at gcc dot gnu.org
2022-06-01 19:21 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-31 20:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (11 preceding siblings ...)
2022-05-31 20:25 ` jason at gcc dot gnu.org
@ 2022-06-01 19:21 ` cvs-commit at gcc dot gnu.org
2022-06-01 19:53 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-01 19:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:e2e471d83d16449a325315c0f33dc52b90ce0fac
commit r13-920-ge2e471d83d16449a325315c0f33dc52b90ce0fac
Author: Jason Merrill <jason@redhat.com>
Date: Tue May 31 16:31:35 2022 -0400
c++: auto and dependent member name [PR105734]
In r12-3643 I improved our handling of type names after . or -> when
unqualified lookup doesn't find anything, but it needs to handle auto
specially.
PR c++/105734
gcc/cp/ChangeLog:
* parser.cc (cp_parser_postfix_dot_deref_expression): Use typeof
if the expression has auto type.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/auto57.C: New test.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (12 preceding siblings ...)
2022-06-01 19:21 ` cvs-commit at gcc dot gnu.org
@ 2022-06-01 19:53 ` cvs-commit at gcc dot gnu.org
2022-06-01 19:54 ` jason at gcc dot gnu.org
2022-06-01 23:13 ` llvm at rifkin dot dev
15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-01 19:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:b090938e61260ce841a0d51de3407881a38e3c52
commit r12-8447-gb090938e61260ce841a0d51de3407881a38e3c52
Author: Jason Merrill <jason@redhat.com>
Date: Tue May 31 16:31:35 2022 -0400
c++: auto and dependent member name [PR105734]
In r12-3643 I improved our handling of type names after . or -> when
unqualified lookup doesn't find anything, but it needs to handle auto
specially.
PR c++/105734
gcc/cp/ChangeLog:
* parser.cc (cp_parser_postfix_dot_deref_expression): Use typeof
if the expression has auto type.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/auto57.C: New test.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (13 preceding siblings ...)
2022-06-01 19:53 ` cvs-commit at gcc dot gnu.org
@ 2022-06-01 19:54 ` jason at gcc dot gnu.org
2022-06-01 23:13 ` llvm at rifkin dot dev
15 siblings, 0 replies; 17+ messages in thread
From: jason at gcc dot gnu.org @ 2022-06-01 19:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.2/13.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
` (14 preceding siblings ...)
2022-06-01 19:54 ` jason at gcc dot gnu.org
@ 2022-06-01 23:13 ` llvm at rifkin dot dev
15 siblings, 0 replies; 17+ messages in thread
From: llvm at rifkin dot dev @ 2022-06-01 23:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #14 from Jeremy R. <llvm at rifkin dot dev> ---
Thank you for the quick patch :)
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2022-06-01 23:13 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26 4:30 [Bug c++/105734] New: Regression: Incorrect "error: invalid use of 'auto'" llvm at rifkin dot dev
2022-05-26 4:46 ` [Bug c++/105734] " llvm at rifkin dot dev
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
2022-05-26 5:03 ` pinskia at gcc dot gnu.org
2022-05-26 5:05 ` [Bug c++/105734] [12/13 Regression]: Incorrect "error: invalid use of 'auto'" for explicit destructor inside a template pinskia at gcc dot gnu.org
2022-05-26 5:07 ` pinskia at gcc dot gnu.org
2022-05-26 5:09 ` pinskia at gcc dot gnu.org
2022-05-26 7:42 ` redi at gcc dot gnu.org
2022-05-26 7:59 ` redi at gcc dot gnu.org
2022-05-26 15:34 ` llvm at rifkin dot dev
2022-05-27 2:32 ` llvm at rifkin dot dev
2022-05-27 6:27 ` rguenth at gcc dot gnu.org
2022-05-31 20:25 ` jason at gcc dot gnu.org
2022-06-01 19:21 ` cvs-commit at gcc dot gnu.org
2022-06-01 19:53 ` cvs-commit at gcc dot gnu.org
2022-06-01 19:54 ` jason at gcc dot gnu.org
2022-06-01 23:13 ` llvm at rifkin dot dev
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).