This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: C++ and useful error messages
- To: "Joe Buck" <jbuck at racerx dot synopsys dot com>,"Gerald Pfeifer" <pfeifer at dbai dot tuwien dot ac dot at>
- Subject: Re: C++ and useful error messages
- From: Steven King <sxking at uswest dot net>
- Date: Thu, 21 Dec 2000 21:25:34 -0800
- Cc: gcc at gcc dot gnu dot org,libstdc++ at gcc dot gnu dot org
- Organization: is the root of all evil
- References: <200012220105.RAA07837@racerx.synopsys.com>
- Reply-To: sxking at uswest dot net
On Thursday 21 December 2000 17:05, Joe Buck wrote:
> Finally, as I suggested before, for any undeclared identifier, we can
> look in std:: and report an additional "perhaps you meant" message if
> found there.
Something of the form of
std::vector<int> a;
without the appropriate declaration being visible results in "`vector'
undeclared in namespace `std'" which is about perfect to me; if we could get
to somehow do something similar when the namespace isn't prefixed, some sort
of implicit prefixing of the current namespace, that would be ideal. ie
vector <int> a;
would give something like "`vector' undeclared in namespace `global'" (or
whatever we call that) and
namespace app
{
vector<int> a;
}
would result in "`vector' undeclared in namespace `app'" and
namespace
{
vector<int> a;
}
would result in "`vector' undeclared in namespace `anonymous'" (or whatever)
and if it then searched all[*] the currently visible namespaces for likely
candidates to suggest that would be just gravy.
[*]
There might be more than one possible candidate; if a user has
#include <vector>
namespace cartesian
{
template <unsigned, typename T> struct vector {/*...*/}
}
std::vector <vector <3, double> > Table;
the user might well be nonplused if the compiler suggests std::vector...