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

            Bug ID: 116422
           Summary: g++-14 fails to build previously accepted unexpanded
                    template code
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jengelh at inai dot de
                CC: mjambor at suse dot cz, rguenth at gcc dot gnu.org
  Target Milestone: ---

== Input ==

```
namespace g {
    template<typename> class ring;
    template<typename> class iter {
        typedef ring<int> domain;
        void operator=(const iter &other) {
            const_cast<domain &>(d) = other.d;
        }
        const domain &d;
    };
}
```

== Observed result ==

Version: gcc version 14.2.0 (SUSE Linux) [home:rguenther:nextgcc]

$ g++-14 -c ri.cpp
ri.cpp: In member function 'void g::iter< <template-parameter-1-1>
>::operator=(const g::iter< <template-parameter-1-1> >&)':
ri.cpp:6:45: error: no match for 'operator=' (operand types are 'g::iter<
<template-parameter-1-1> >::domain' {aka 'g::ring<int>'} and 'const g::iter<
<template-parameter-1-1> >::domain' {aka 'const g::ring<int>'})
    6 |             const_cast<domain &>(d) = other.d;


== Expected result ==

Succeed(?) like gcc 13.

g++-13 -c ri.cpp
$?=0


== Full-blown sample code ==

Install givaro-devel from your distribution or
https://github.com/linbox-team/givaro . Then

g++-14 -x c++ -c /usr/include/givaro/random-integer.h 
/usr/include/givaro/random-integer.h: In member function
'Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>&
Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>::operator=(const
Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>&)':
/usr/include/givaro/random-integer.h:94:54: error: no match for 'operator='
(operand types are 'Givaro::RandomIntegerIterator<_Unsigned,
_Exact_Size>::Integer_Domain' {aka 'Givaro::ZRing<Givaro::Integer>'} and 'const
Givaro::RandomIntegerIterator<_Unsigned, _Exact_Size>::Integer_Domain' {aka
'const Givaro::ZRing<Givaro::Integer>'})
   94 |                 const_cast<Integer_Domain&>(_ring)=R._ring;

Reply via email to