This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/38759] New: Incorrect warning/error when compiling with a typedef'ed ptr return type


When a pointer to type is typedef'ed to a new type gcc incorrectly warns about
const modifier if new typedef is used in function return type.

gcc info:
dluadrianc:/home/adrianc> gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3.1/configure --prefix=/usr --enable-languages=c,c++
--enable-shared --enable-threads=posix
Thread model: posix
gcc version 4.3.1 (GCC) 

Command line:g++ -save-temps -Wall -ansi -Wextra -pedantic -Werror const.cc
Error message:
cc1plus: warnings being treated as errors
const.cc:10: error: type qualifiers ignored on function return type

Code
# 1 "const.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "const.cc"
class Foo { };

const Foo *func1()
{
   return 0;
}

typedef Foo* Bar;

const Bar func2()
{
   return 0;
}

int main(int , char *[])
{
   func1();
   func2();

   return 0;
}


-- 
           Summary: Incorrect warning/error when compiling with a typedef'ed
                    ptr return type
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gnu at bluedreamer dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]