public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't
@ 2020-08-10 17:52 mpolacek at gcc dot gnu.org
2021-04-28 15:17 ` [Bug c++/96560] " ppalka at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-10 17:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96560
Bug ID: 96560
Summary: Substitution triggers compile-time error when it
shouldn't
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
This triggers the static_assert while it shouldn't, because DR 1227 says "The
substitution proceeds in lexical order and stops when a condition that causes
deduction to fail is encountered." Compiles with clang++/EDG.
template<bool, typename = void>
struct enable_if { };
template<typename T>
struct enable_if<true, T> {
using type = T;
};
template<class T>
struct hard_error {
static_assert(sizeof(T) == 0);
static inline constexpr bool value = true;
};
template<class T>
struct always_false {
static inline constexpr bool value = false;
};
template<class T>
int foo (int, typename enable_if<always_false<T>::value, int>::type = 0,
typename enable_if<hard_error<T>::value, int>::type = 0 )
{
return 0;
}
template<class T>
char const *foo (long)
{
return "";
}
int
main ()
{
char const *sz = foo<int>(0);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96560] Substitution triggers compile-time error when it shouldn't
2020-08-10 17:52 [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't mpolacek at gcc dot gnu.org
@ 2021-04-28 15:17 ` ppalka at gcc dot gnu.org
2021-06-09 14:28 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-28 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96560
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-04-28
CC| |ppalka at gcc dot gnu.org
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96560] Substitution triggers compile-time error when it shouldn't
2020-08-10 17:52 [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't mpolacek at gcc dot gnu.org
2021-04-28 15:17 ` [Bug c++/96560] " ppalka at gcc dot gnu.org
@ 2021-06-09 14:28 ` mpolacek at gcc dot gnu.org
2021-06-11 20:09 ` cvs-commit at gcc dot gnu.org
2021-06-11 20:11 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-09 14:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96560
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-April/569184.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96560] Substitution triggers compile-time error when it shouldn't
2020-08-10 17:52 [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't mpolacek at gcc dot gnu.org
2021-04-28 15:17 ` [Bug c++/96560] " ppalka at gcc dot gnu.org
2021-06-09 14:28 ` mpolacek at gcc dot gnu.org
@ 2021-06-11 20:09 ` cvs-commit at gcc dot gnu.org
2021-06-11 20:11 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-11 20:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96560
--- Comment #2 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:b0d73a66ae3962fa83309527d85613d72a6aa43d
commit r12-1398-gb0d73a66ae3962fa83309527d85613d72a6aa43d
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jun 11 16:00:52 2021 -0400
c++: Substitute into function parms in lexical order [PR96560]
This makes tsubst_arg_types substitute into a function's parameter types
in left-to-right instead of right-to-left order, in accordance with DR
1227.
DR 1227
PR c++/96560
gcc/cp/ChangeLog:
* pt.c (tsubst_arg_types): Rearrange so that we substitute into
TYPE_ARG_TYPES in forward order while short circuiting
appropriately. Adjust formatting.
gcc/testsuite/ChangeLog:
* g++.dg/template/sfinae-dr1227.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/96560] Substitution triggers compile-time error when it shouldn't
2020-08-10 17:52 [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't mpolacek at gcc dot gnu.org
` (2 preceding siblings ...)
2021-06-11 20:09 ` cvs-commit at gcc dot gnu.org
@ 2021-06-11 20:11 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-11 20:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96560
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Target Milestone|--- |12.0
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-11 20:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 17:52 [Bug c++/96560] New: Substitution triggers compile-time error when it shouldn't mpolacek at gcc dot gnu.org
2021-04-28 15:17 ` [Bug c++/96560] " ppalka at gcc dot gnu.org
2021-06-09 14:28 ` mpolacek at gcc dot gnu.org
2021-06-11 20:09 ` cvs-commit at gcc dot gnu.org
2021-06-11 20:11 ` ppalka 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).