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

            Bug ID: 83248
           Summary: Spuriously identifying template arguments
           Product: gcc
           Version: 5.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mimomorin at gmail dot com
  Target Milestone: ---

On g++-5 in C++ 11, 14, 17 modes, this valid code fails to compile
(tested on g++-5.4 and 5.5, also failed on g++-4.9)

    #include <iostream>

    typedef unsigned long long cl_ulong __attribute__((aligned(8)));

    void f()
    {
        cl_ulong x = 0;
        std::cout << x;
    }

    template <class T> struct is_unsigned {};
    template <> struct is_unsigned<      unsigned long long> {};
    template <> struct is_unsigned<const unsigned long long> {};

with the following error messages

    Line13: error: redefinition of 'struct is_unsigned<long long unsigned int>'
     template <> struct is_unsigned<const unsigned long long> {};
                        ^
    Line12: error: previous definition of 'struct is_unsigned<long long
unsigned int>'
     template <> struct is_unsigned<      unsigned long long> {};
                        ^

G++-6, 7 (and 4.8) work fine. 

I made this testcase by inspecting the bug report to Boost.TypeTraits
(https://svn.boost.org/trac10/ticket/13315).
I tried to make a smaller testcase, but I couldn't get one.

Reply via email to