public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type
@ 2015-10-08 20:10 richard-gccbugzilla at metafoo dot co.uk
2021-08-12 1:46 ` [Bug c++/67898] " pinskia at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2015-10-08 20:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Bug ID: 67898
Summary: rejects-valid on overloaded function as non-type
template argument of dependent type
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: richard-gccbugzilla at metafoo dot co.uk
Target Milestone: ---
Test case:
void f(int);
void f(float);
template<typename T, T F, T G, bool b = F == G> struct X {};
template<typename T> void test() { X<void(T), f, f>(); }
int main() { test<int>(); }
GCC rejects this valid code saying:
<stdin>:4:51: error: ‘void(T)’ is not a valid type for a template non-type
parameter
<stdin>:4:51: error: ‘void(T)’ is not a valid type for a template non-type
parameter
<stdin>:4:51: error: template argument 4 is invalid
If we work around this bug by changing the code as follows:
template<typename T> void test() { X<void(*)(T), f, f>(); }
... then we get a different rejects-valid:
<stdin>:3:43: error: invalid operands of types ‘<unresolved overloaded
function type>’ and ‘<unresolved overloaded function type>’ to binary
‘operator==’
<stdin>:4:54: error: template argument 4 is invalid
>From gcc-bugs-return-499051-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Oct 08 20:19:38 2015
Return-Path: <gcc-bugs-return-499051-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5957 invoked by alias); 8 Oct 2015 20:19:37 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5898 invoked by uid 48); 8 Oct 2015 20:19:33 -0000
From: "aaro.koskinen at iki dot fi" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/67899] New: build failure in the sanitizer libs on sparc-linux-gnu
Date: Thu, 08 Oct 2015 20:19:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 5.2.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: aaro.koskinen at iki dot fi
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone
Message-ID: <bug-67899-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-10/txt/msg00606.txt.bz2
Content-length: 5509
https://gcc.gnu.org/bugzilla/show_bug.cgi?idg899
Bug ID: 67899
Summary: build failure in the sanitizer libs on sparc-linux-gnu
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: aaro.koskinen at iki dot fi
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
Target Milestone: ---
Sanitizer lib build is broken on sparc-linux-gnu:
libtool: compile: /build/los/work/sparc/gcc-full-5.2.0-build/./gcc/xgcc
-shared-libgcc -B/build/los/work/sparc/gcc-full-5.2.0-build/./gcc -nostdinc++
-L/build/los/work/sparc/gcc-full-5.2.0-build/sparc-linux-gnu/libstdc++-v3/src
-L/build/los/work/sparc/gcc-full-5.2.0-build/sparc-linux-gnu/libstdc++-v3/src/.libs
-L/build/los/work/sparc/gcc-full-5.2.0-build/sparc-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/build/los/work/sparc/toolchain/sparc-linux-gnu/bin/
-B/build/los/work/sparc/toolchain/sparc-linux-gnu/lib/ -isystem
/build/los/work/sparc/toolchain/sparc-linux-gnu/include -isystem
/build/los/work/sparc/toolchain/sparc-linux-gnu/sys-include -D_GNU_SOURCE
-D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-DHAVE_RPC_XDR_H=1 -DHAVE_TIRPC_RPC_XDR_H=0 -I.
-I/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common -I.. -I
/build/los/work/shared/gcc-5.2.0/libsanitizer/include -isystem
/build/los/work/shared/gcc-5.2.0/libsanitizer/include/system -Wall -W
-Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC
-fno-builtin -fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables
-fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include
-I../../libstdc++-v3/include/sparc-linux-gnu
-I/build/los/work/shared/gcc-5.2.0/libsanitizer/../libstdc++-v3/libsupc++
-std=gnu++11 -DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I
/build/los/work/shared/gcc-5.2.0/libsanitizer/../libbacktrace -I
../libbacktrace -I /build/los/work/shared/gcc-5.2.0/libsanitizer/../include
-include
/build/los/work/shared/gcc-5.2.0/libsanitizer/libbacktrace/backtrace-rename.h
-g -O2 -D_GNU_SOURCE -MT sanitizer_platform_limits_posix.lo -MD -MP -MF
.deps/sanitizer_platform_limits_posix.Tpo -c
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
-fPIC -DPIC -o .libs/sanitizer_platform_limits_posix.o
In file included from
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:180:0:
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:272:72:
error: size of array 'assertion_failed__990' is negative
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:266:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:990:1:
note: in expansion of macro 'COMPILER_CHECK'
COMPILER_CHECK(sizeof(__sanitizer_sigaction) == sizeof(struct sigaction));
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:272:72:
error: size of array 'assertion_failed__994' is negative
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:266:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1353:3:
note: in expansion of macro 'COMPILER_CHECK'
COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:994:1:
note: in expansion of macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_flags);
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:272:72:
error: size of array 'assertion_failed__996' is negative
typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:266:30:
note: in expansion of macro 'IMPL_COMPILER_ASSERT'
#define COMPILER_CHECK(pred) IMPL_COMPILER_ASSERT(pred, __LINE__)
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h:1353:3:
note: in expansion of macro 'COMPILER_CHECK'
COMPILER_CHECK(offsetof(struct __sanitizer_##CLASS, MEMBER) == \
^
/build/los/work/shared/gcc-5.2.0/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:996:1:
note: in expansion of macro 'CHECK_STRUCT_SIZE_AND_OFFSET'
CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_restorer);
^
Makefile:449: recipe for target 'sanitizer_platform_limits_posix.lo' failed
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
@ 2021-08-12 1:46 ` pinskia at gcc dot gnu.org
2021-10-07 20:41 ` ppalka at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 1:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |61355
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect when PR 61355 is fixed, this one will be fixed but not 100% sure.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61355
[Bug 61355] gcc doesn't normalize type in non-type template parameters
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
2021-08-12 1:46 ` [Bug c++/67898] " pinskia at gcc dot gnu.org
@ 2021-10-07 20:41 ` ppalka at gcc dot gnu.org
2021-10-11 20:00 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-07 20:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Bug 67898 depends on bug 61355, which changed state.
Bug 61355 Summary: gcc doesn't normalize type in non-type template parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61355
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
2021-08-12 1:46 ` [Bug c++/67898] " pinskia at gcc dot gnu.org
2021-10-07 20:41 ` ppalka at gcc dot gnu.org
@ 2021-10-11 20:00 ` ppalka at gcc dot gnu.org
2022-04-06 19:53 ` ppalka at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-11 20:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
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
CC| |ppalka at gcc dot gnu.org
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
` (2 preceding siblings ...)
2021-10-11 20:00 ` ppalka at gcc dot gnu.org
@ 2022-04-06 19:53 ` ppalka at gcc dot gnu.org
2024-01-19 18:35 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-06 19:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Related rejects-valid C++11 testcase:
template<class T, T V, class = decltype(V)> struct A;
template<class U> using B = A<U, 0>;
using type = A<bool, 0>;
using type = B<bool>; // incorrectly resolves to A<bool, 0, int>
// instead of A<bool, 0, bool>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
` (3 preceding siblings ...)
2022-04-06 19:53 ` ppalka at gcc dot gnu.org
@ 2024-01-19 18:35 ` cvs-commit at gcc dot gnu.org
2024-01-19 18:39 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-19 18:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:f1e5bf0d83ee4da81b6317c6d7f1278fe7eaa5a0
commit r14-8291-gf1e5bf0d83ee4da81b6317c6d7f1278fe7eaa5a0
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jan 17 17:29:33 2024 -0500
c++: alias template argument conversion [PR112632]
We've had a problem with lost conversions to template parameter types for a
while now; looking at this PR, it occurred to me that the problem is really
with alias (and concept) templates, since we do substitution of dependent
arguments into them in a way that we don't for other templates. And fixing
that specific problem is a lot simpler than adding IMPLICIT_CONV_EXPR
around
all dependent template arguments the way I gave up on for 111357.
The other part of the fix was changing tsubst_expr to actually call
convert_nontype_argument instead of assuming it will eventually happen.
I waffled about stripping the forced conversion when !force_conv
vs. skipping them in iterative_hash_template_arg and
template_args_equal (like we already do for some other conversions) and
decided to go with the former, but that isn't a strong preference if it
turns out to be somehow problematic.
PR c++/112632
PR c++/112594
PR c++/111357
PR c++/104594
PR c++/67898
gcc/cp/ChangeLog:
* cp-tree.h (IMPLICIT_CONV_EXPR_FORCED): New.
* pt.cc (expand_integer_pack): Remove 111357 workaround.
(maybe_convert_nontype_argument): Add force parm.
(convert_template_argument): Handle alias template args
specially.
(tsubst_expr): Don't ignore IMPLICIT_CONV_EXPR_NONTYPE_ARG.
* error.cc (dump_expr) [CASE_CONVERT]: Handle null optype.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-nontype1.C: New test.
* g++.dg/cpp2a/concepts-narrowing1.C: New test.
* g++.dg/cpp2a/nontype-class63.C: New test.
* g++.dg/cpp2a/nontype-class63a.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
` (4 preceding siblings ...)
2024-01-19 18:35 ` cvs-commit at gcc dot gnu.org
@ 2024-01-19 18:39 ` jason at gcc dot gnu.org
2024-01-19 19:33 ` jason at gcc dot gnu.org
2024-01-30 17:30 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-19 18:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
Status|ASSIGNED |RESOLVED
Target Milestone|--- |12.0
Resolution|--- |FIXED
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
The original testcase was indeed fixed by the patch for 61355, and Patrick's
unrelated testcase in comment 4 is fixed by my commit just now. Closing as
fixed in 12, but that only applies to the original testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
` (5 preceding siblings ...)
2024-01-19 18:39 ` jason at gcc dot gnu.org
@ 2024-01-19 19:33 ` jason at gcc dot gnu.org
2024-01-30 17:30 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-19 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.0 |14.0
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Apparently I was confused, and my patch was also needed for the original
testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/67898] rejects-valid on overloaded function as non-type template argument of dependent type
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
` (6 preceding siblings ...)
2024-01-19 19:33 ` jason at gcc dot gnu.org
@ 2024-01-30 17:30 ` cvs-commit at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-30 17:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67898
--- Comment #8 from GCC 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:1a4c47e10e8ba06f04de2d41a040ba1494843a01
commit r14-8634-g1a4c47e10e8ba06f04de2d41a040ba1494843a01
Author: Patrick Palka <ppalka@redhat.com>
Date: Tue Jan 30 12:30:32 2024 -0500
c++: add original testcase [PR67898]
The original testcase from this PR (fixed by r14-8291) seems rather
different from the others, so let's add it to the testsuite.
PR c++/67898
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/temp_default8.C: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-30 17:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 20:10 [Bug c++/67898] New: rejects-valid on overloaded function as non-type template argument of dependent type richard-gccbugzilla at metafoo dot co.uk
2021-08-12 1:46 ` [Bug c++/67898] " pinskia at gcc dot gnu.org
2021-10-07 20:41 ` ppalka at gcc dot gnu.org
2021-10-11 20:00 ` ppalka at gcc dot gnu.org
2022-04-06 19:53 ` ppalka at gcc dot gnu.org
2024-01-19 18:35 ` cvs-commit at gcc dot gnu.org
2024-01-19 18:39 ` jason at gcc dot gnu.org
2024-01-19 19:33 ` jason at gcc dot gnu.org
2024-01-30 17:30 ` cvs-commit 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).