Skip to content

ccls says erroneously "ccls [3]: use of undeclared identifier 'std'" #21547

@gav451

Description

@gav451

brew doctor output

Your system is ready to brew.

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • My "brew doctor output" above says Your system is ready to brew or a definitely unrelated Tier message.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 5.0.13
ORIGIN: https://github.com/Homebrew/brew
HEAD: 2a48e23bc9dc24a78bcb982167574985f5bd6784
Last commit: 6 days ago
Branch: stable
Core tap JSON: 08 Feb 12:09 UTC
Core cask tap JSON: 08 Feb 12:09 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.5oFOiu3UTC/org.xquartz:0
HOMEBREW_DOWNLOAD_CONCURRENCY: 20
HOMEBREW_EDITOR: emacsclient -q -a ""
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.4.8 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.8/bin/ruby
CPU: deca-core 64-bit arm_donan
Clang: 17.0.0 build 1700
Git: 2.52.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.2-arm64
CLT: 26.2.0.0.1.1764812424
Xcode: 26.2
Metal Toolchain: N/A
Rosetta 2: false

What were you trying to do (and why)?

I was trying to eliminate errors and warnings from C++ code by means of the ccls language server.
I was using the built-in eglot package of emacs-plus as front-end of ccls, but the front-end should not matter.

What happened (include all command output)?

An minimal example is:

#include <string>

int main() {
  std::string hello = "Hello World";
  return 0;
}

where ccls returns the following error:

    4   2 error    e-f-b    ccls [3]: use of undeclared identifier 'std'

where the 4 and 2 are the position of the error. I have the following .ccls configuration file

clang
-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__cxx03
%c -std=c11
%cpp -std=c++20

What did you expect to happen?

I expected that ccls told me that the minimal example is correct (as compiling the example as well as using clangd confirm).

Step-by-step reproduction instructions (by running brew commands)

brew install emacs-plus
brew install ccls

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions