Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No 'aka' in diagnostics about temporary values. #13225

Open
belkadan opened this issue May 16, 2012 · 1 comment
Open

No 'aka' in diagnostics about temporary values. #13225

belkadan opened this issue May 16, 2012 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer quality-of-implementation

Comments

@belkadan
Copy link
Contributor

Bugzilla Link 12853
Version trunk
OS All

Extended Description

#include
#include

using namespace std;

size_t test (vector &strings) {
return strings.begin().length();
}

We get this error:

error: no member named 'length' in '__gnu_cxx::__normal_iterator<std::basic_string *, std::vector<std::basic_string, std::allocator<std::basic_string>>>'; did you mean to use '->' instead of '.'?

It'd be nice to say something like:

error: no member named 'length' in 'vector::iterator' (aka '...'); did you mean to use '->' instead of '.'?

i.e. use the spelling in the declaration of vector::begin, scoped to the spelling used to declare 'strings'.

(If it matters, GCC doesn't do any better.)

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
@Endilll Endilll added clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer and removed clang Clang issues not falling into any other category labels May 21, 2023
@Endilll
Copy link
Contributor

Endilll commented May 21, 2023

Clang 16 still issues the same sugar-free template declaration. GCC 13 do much better job these days:
error: 'std::vector<std::__cxx11::basic_string<char> >::iterator' has no member named 'length'.
Message is shorter with libc++, but I'm not sure if it's in the way author wanted:
error: no member named 'length' in 'std::__wrap_iter<std::string *>'; did you mean to use '->' instead of '.'?
https://godbolt.org/z/5aGPovY68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer quality-of-implementation
Projects
None yet
Development

No branches or pull requests

2 participants