[Bug c++/25525] New: 'const' modifier is ignored in static_cast specifier

yuri at tsoft dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 21 22:47:00 GMT 2005


The following code produces 'casting away constness' error on 'static_cast'
line. Should be no warning.

------------- code -----------------------

struct A { };
struct B : A { };

template<typename PTR>
const PTR mycast(const A *a) {
  return (static_cast<const PTR>(a));
}

const B* mycast(const A *a) {
  return (mycast<B*>(a));
}


-- 
           Summary: 'const' modifier is ignored in static_cast specifier
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yuri at tsoft dot com


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



More information about the Gcc-bugs mailing list