public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64587] New: [C++11] Wrong number of template arguments when template template parameter is template alias.
@ 2015-01-13 23:16 splinterofchaos at gmail dot com
  2015-01-14 11:13 ` [Bug c++/64587] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: splinterofchaos at gmail dot com @ 2015-01-13 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64587
           Summary: [C++11] Wrong number of template arguments when
                    template template parameter is template alias.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: splinterofchaos at gmail dot com

Created attachment 34439
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34439&action=edit
The error-producing file.

As far as I have been able to gather, and according to everyone I've asked, the
following should be valid:


#include <utility>

template<class T>
using decay = typename std::decay<T>::type;

template<template<class...>class T, class...X>
struct Part {
  template<class...Y>
  using type = T<X..., Y...>;
};

template<template<class...>class T, template<class>class U>
struct UCompose {
  // Not ok!
  template<class X, class...Y>
  using type = T<U<X>, Y...>;

  //// Ok!
  //template<class X>
  //using type = T<U<X>>;
};

int main() {
  using IsInt = Part<std::is_same, int>;
  static_assert(IsInt::type<int>::value, "");    // Ok!
  using IsIntD = UCompose<IsInt::type, decay>;
  static_assert(IsIntD::type<int&>::value, "");  // Not ok.
}


The error is:


$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.1-16ubuntu6'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--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.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-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,mx32 --enable-multilib
--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.9.1 (Ubuntu 4.9.1-16ubuntu6) 

$ g++ tmp.cpp --std=c++11 -Wall -Wextra -save-temps
tmp.cpp: In substitution of ‘template<template<class ...> class T, class ... X>
template<class ... Y> using type = T<X ..., Y ...> [with Y = {typename
std::decay<_Tp>::type, Y ...}; T = std::is_same; X = {int}]’:
tmp.cpp:16:29:   required from ‘struct UCompose<Part<std::is_same, int>::type,
decay>’
tmp.cpp:27:23:   required from here
tmp.cpp:9:29: error: wrong number of template arguments (3, should be 2)
   using type = T<X..., Y...>;
                             ^
In file included from /usr/include/c++/4.9/bits/move.h:57:0,
                 from /usr/include/c++/4.9/bits/stl_pair.h:59,
                 from /usr/include/c++/4.9/utility:70,
                 from tmp.cpp:1:
/usr/include/c++/4.9/type_traits:922:12: error: provided for ‘template<class,
class> struct std::is_same’
     struct is_same;
            ^


The message, "wrong number of template arguments" implies that three parameters
are passed, but above it says "X = {int}" and "Y = {typename
std::decay<_Tp>::type, Y ...}". The "Y ..." here should be empty; perhaps it
comes from "UCompose::type", where again the "Y..." should be empty.

I have tried with gcc 4.8 and get the same error message. Attached is the
output from -save-temps
>From gcc-bugs-return-473092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 13 23:17:43 2015
Return-Path: <gcc-bugs-return-473092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25052 invoked by alias); 13 Jan 2015 23:17:42 -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 25029 invoked by uid 48); 13 Jan 2015 23:17:37 -0000
From: "damian at sourceryinstitute dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64589] New: Undefined reference to integer 4 with unlimited polymorphism in two modules plus main
Date: Tue, 13 Jan 2015 23:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: damian at sourceryinstitute dot org
X-Bugzilla-Status: UNCONFIRMED
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
Message-ID: <bug-64589-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-01/txt/msg01086.txt.bz2
Content-length: 1342

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd589

            Bug ID: 64589
           Summary: Undefined reference to integer 4 with unlimited
                    polymorphism in two modules plus main
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: damian at sourceryinstitute dot org

Using unlimited polymorphism appears to generate a linking error due to an
unrecognized integer symbol:

$cat more-fun-with-unlimited-poly.f90
module ASTG_FormatParser_mod
contains
  subroutine fmt()
    class(*), pointer :: arg
    select type (arg)
    type is (integer)
    end select
  end subroutine
end module
module ASTG_MpiFileHandler_mod
contains
  subroutine makeString(arg1)
    class(*) :: arg1
  end subroutine
  subroutine getSuffix()
    use ASTG_FormatParser_mod
    call makeString(1)
  end subroutine
end module
end
$gfortran more-fun-with-unlimited-poly.f90
/tmp/cccnDYiT.o: In function `__astg_mpifilehandler_mod_MOD_getsuffix':
more-fun-with-unlimited-poly.f90:(.text+0x44): undefined reference to
`__vtab_INTEGER_4_.3435'
collect2: error: ld returned 1 exit status
$gfortran --version | head -1
GNU Fortran (GCC) 5.0.0 20141222 (experimental)


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

* [Bug c++/64587] [C++11] Wrong number of template arguments when template template parameter is template alias.
  2015-01-13 23:16 [Bug c++/64587] New: [C++11] Wrong number of template arguments when template template parameter is template alias splinterofchaos at gmail dot com
@ 2015-01-14 11:13 ` redi at gcc dot gnu.org
  2021-07-31 21:03 ` pinskia at gcc dot gnu.org
  2023-03-15  3:09 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-14 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 64588 has been marked as a duplicate of this bug. ***


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

* [Bug c++/64587] [C++11] Wrong number of template arguments when template template parameter is template alias.
  2015-01-13 23:16 [Bug c++/64587] New: [C++11] Wrong number of template arguments when template template parameter is template alias splinterofchaos at gmail dot com
  2015-01-14 11:13 ` [Bug c++/64587] " redi at gcc dot gnu.org
@ 2021-07-31 21:03 ` pinskia at gcc dot gnu.org
  2023-03-15  3:09 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-31 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Hmm, this code starts to be accepted in GCC 7.

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

* [Bug c++/64587] [C++11] Wrong number of template arguments when template template parameter is template alias.
  2015-01-13 23:16 [Bug c++/64587] New: [C++11] Wrong number of template arguments when template template parameter is template alias splinterofchaos at gmail dot com
  2015-01-14 11:13 ` [Bug c++/64587] " redi at gcc dot gnu.org
  2021-07-31 21:03 ` pinskia at gcc dot gnu.org
@ 2023-03-15  3:09 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-15  3:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |7.0
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Indeed, fixed in GCC 7.

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

end of thread, other threads:[~2023-03-15  3:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-13 23:16 [Bug c++/64587] New: [C++11] Wrong number of template arguments when template template parameter is template alias splinterofchaos at gmail dot com
2015-01-14 11:13 ` [Bug c++/64587] " redi at gcc dot gnu.org
2021-07-31 21:03 ` pinskia at gcc dot gnu.org
2023-03-15  3:09 ` jason 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).