Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7996461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:42:54+00:00 2026-06-04T14:42:54+00:00

I have a class Cache which has a function write specified as bool write(const

  • 0

I have a class Cache which has a function write specified as

bool write(const MemoryAccess &memory_access, CacheLine &cl);

I am calling this function like this.

const Cache *this_cache;
c = (a==b)?my_cache:not_cache;
c->write(memory_access,cl);

The above line is giving me following error

“passing ‘const Cache’ as ‘this’ argument of ‘bool Cache::write(const
MemoryAccess&, CacheLine&)’ discards qualifiers [-fpermissive].”

the this argument is compiler specific which helps in code-mangling and breaking local namespace variable priority. But such a variable is not being passed here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:42:55+00:00Added an answer on June 4, 2026 at 2:42 pm

    Since c is of type const Cache *, you can only call const member functions on it.

    You have two options:

    (1) remove const from the declaration of c;

    (2) change Cache::write() like so:

     bool write(const MemoryAccess &memory_access, CacheLine &cl) const;
    

    (Note the added const at the end.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given I have an immutable class of which a GetHashCode() function has been written,
I have a singleton class, that has a map which can be accessed by
I have a cache which has soft references to the cached objects. I am
I have a script running in a server, which is calling a function in
Background: I have a MainTest class that has many buttons, each of which instantiate
I have: @Component class MyDecorator{ private Cache cache; /* some wrapped methods like get
I have class A, which exposes an event. an object of class B subscribed
I have class Fred { public: void inspect() const {}; void modify(){}; }; int
I have a caching class that has a flat file driver, meaning you can
I have two objects - ContentPage , which has a collection of ChildLinks .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.