Bug 32208 - Patch for 32158 has bad code in std::vector::_M_fill_initialize
Summary: Patch for 32158 has bad code in std::vector::_M_fill_initialize
Status: RESOLVED DUPLICATE of bug 32233
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-04 18:52 UTC by Michael Elizabeth Chastain
Modified: 2007-06-06 22:57 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Elizabeth Chastain 2007-06-04 18:52:16 UTC
mec@hollerith:~/exp-43-redux$ cat vector-fill.cc 
// Copyright 2007, Google Inc.  All rights reserved.
// Author: mec@google.com  (Michael Chastain)

#include <vector>

std::vector<int> my_vector (117);

===

mec@hollerith:~/exp-43-redux$ /home/mec/gcc-4.3-20070601/install/bin/g++ -Wall -S vector-fill.cc 
/home/mec/gcc-4.3-20070601/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_vector.h: In member function 'int std::vector<_Tp, _Alloc>::_M_fill_initialize(size_t, const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]':
/home/mec/gcc-4.3-20070601/install/lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../include/c++/4.3.0/bits/stl_vector.h:832: warning: control reaches end of non-void function

===

This is from: http://gcc.gnu.org/viewcvs/trunk/libstdc%2B%2B-v3/include/bits/stl_vector.h?r1=124243&r2=125223

Trivial lack of "void".

===

Also, shouldn't there also be an error about lack of return type for _M_fill_initialize?
Comment 1 Andrew Pinski 2007-06-06 21:13:26 UTC

*** This bug has been marked as a duplicate of 32233 ***
Comment 2 Volker Reichelt 2007-06-06 22:57:01 UTC
Just a note:

> Also, shouldn't there also be an error about lack of return type for
> _M_fill_initialize?

Well, here's the code snippet from the function grokdeclarator in decl.c
that deals with missing return types:

      if (type_was_error_mark_node)
	/* We've already issued an error, don't complain more.  */;
      else if (in_system_header || flag_ms_extensions)
	/* Allow it, sigh.  */;
      else if (pedantic || ! is_main)
	pedwarn ("ISO C++ forbids declaration of %qs with no type", name);
      else
	warning (OPT_Wreturn_type,
                 "ISO C++ forbids declaration of %qs with no type", name);

As you can see, return types may be omitted in system headers
(probably because there were too many systems with such headers around).
Otherwise you should get a diagnostic.