public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument
@ 2013-06-08 22:37 hstong at ca dot ibm.com
  2013-06-09 21:12 ` [Bug c++/57570] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hstong at ca dot ibm.com @ 2013-06-08 22:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57570

            Bug ID: 57570
           Summary: Deduction succeeds despite type mismatch of non-type
                    template parameter and deduced argument
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hstong at ca dot ibm.com

GCC does not consistently fail deduction for type mismatch of a non-type
template parameter and the corresponding deduced argument.

See N3690 subclause 14.8.2.5 [temp.deduct.type] paragraph 17.

### STANDALONE SOURCE:
template <short, char> struct A;

int foo(void *);
template <short x> int foo(A<x, x> *ap)
   // neither clang++ nor g++ bother to look at the second instance of x
   // for deduction
{ return noGood(ap); }

int bar(void *);
template <char y> int bar(A<y, y> *ap)
   // okay; clang++ and g++ both realize that deducing from the first instance
   // of y is no good
{ return noGood(ap); }

int zip(void *, void *);
template <short x, char y> int zip(A<x, y> *ap, A<y, x> *)
   // clang++ does not bother to look at the second function argument
   // for deduction, g++ does
{ return noGood(ap); }

A<0, 0> *ap = 0;

int a = foo(ap);  // clang++ and g++ both fail to fail the argument deduction
int b = bar(ap);  // clang++ and g++ both successfully fail the deduction
int c = zip(ap, ap);  //
   // clang++ fails to fail and g++ successfully fails the argument deduction

// For all three:
// - MSVC 17.00.51025 fails to fail the argument deduction
// - ICC 13.0.1 20121010 and IBM XL C/C++ for AIX 12.1.0.3 work fine


### COMPILER INVOCATION:
g++ -std=c++11 -c main.cpp


### EXPECTED OUTPUT:
Successful compile.


### ACTUAL OUTPUT:
main.cpp: In instantiation of 'int foo(A<x, x>*) [with short int x = 0]':
main.cpp:23:15:   required from here
main.cpp:7:12: error: 'noGood' was not declared in this scope


### g++ -v OUTPUT:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.8.1-2ubuntu1~12.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~12.04)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57570] Deduction succeeds despite type mismatch of non-type template parameter and deduced argument
  2013-06-08 22:37 [Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument hstong at ca dot ibm.com
@ 2013-06-09 21:12 ` daniel.kruegler at googlemail dot com
  2021-12-04  0:07 ` pinskia at gcc dot gnu.org
  2021-12-09  9:27 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-06-09 21:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57570

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The problem also exists for gcc 4.9.0 20130519 (experimental) (tested on
mingw-64 bit)
>From gcc-bugs-return-424077-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Jun 09 21:36:53 2013
Return-Path: <gcc-bugs-return-424077-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28538 invoked by alias); 9 Jun 2013 21:36:53 -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 28494 invoked by uid 48); 9 Jun 2013 21:36:49 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/6526] [SH4] sdivsi3_i4 can clobber xd0/xd2
Date: Sun, 09 Jun 2013 21:36:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 3.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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_status cc resolution
Message-ID: <bug-6526-4-iakzDq8A8G@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-6526-4@http.gcc.gnu.org/bugzilla/>
References: <bug-6526-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: 2013-06/txt/msg00456.txt.bz2
Content-length: 824

http://gcc.gnu.org/bugzilla/show_bug.cgi?ide26

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |olegendo at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #13 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Fixed in 4.9. by picking up the suggestions from comment #3.

http://gcc.gnu.org/viewcvs/gcc?view=revision&revision\x199873

    PR target/6526
    * config/sh/lib1funcs.S (sdivsi3_i4, udivsi3_i4): Do not change bits
    other than FPSCR.PR and FPSCR.SZ.  Add SH4A implementation.

    PR target/6526
    * gcc.target/sh/pr6526.c: New.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57570] Deduction succeeds despite type mismatch of non-type template parameter and deduced argument
  2013-06-08 22:37 [Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument hstong at ca dot ibm.com
  2013-06-09 21:12 ` [Bug c++/57570] " daniel.kruegler at googlemail dot com
@ 2021-12-04  0:07 ` pinskia at gcc dot gnu.org
  2021-12-09  9:27 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-04  0:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57570

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |5.1.0, 6.1.0, 7.1.0, 7.5.0
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-12-04
           Keywords|                            |needs-bisection
      Known to work|                            |8.1.0
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Seems to be fixed in GCC 8+.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57570] Deduction succeeds despite type mismatch of non-type template parameter and deduced argument
  2013-06-08 22:37 [Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument hstong at ca dot ibm.com
  2013-06-09 21:12 ` [Bug c++/57570] " daniel.kruegler at googlemail dot com
  2021-12-04  0:07 ` pinskia at gcc dot gnu.org
@ 2021-12-09  9:27 ` marxin at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57570

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed with r8-4678-g6296cf8e099aae43.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-09  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-08 22:37 [Bug c++/57570] New: Deduction succeeds despite type mismatch of non-type template parameter and deduced argument hstong at ca dot ibm.com
2013-06-09 21:12 ` [Bug c++/57570] " daniel.kruegler at googlemail dot com
2021-12-04  0:07 ` pinskia at gcc dot gnu.org
2021-12-09  9:27 ` marxin 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).