GithubHelp home page GithubHelp logo

Comments (8)

mclow avatar mclow commented on May 17, 2024 1

It's a false positive. In C++11, there were severe limitations on what a constexpr function could do. Effectively, they were limited to a single return statement.

Breaking this down, it looks like this:

return i >= size ()
   ? boost_throw_exception(...), true
   : true;

The , true on the second line there is necessary, because otherwise the two halves of the ternary (?:) expression would have different types, and the compiler would emit an error for that. Try removing the , true and you will see what I mean.

If you were writing this for C++14 and later, it would be clearer:

if (i >= size())
    throw boost_throw_exception(...);
return true;

but that won't compile for C++11

from array.

mclow avatar mclow commented on May 17, 2024 1

Sounds like a bug in -Wcomma. (and I have verified that enabling that warning does throw a warning, with a completely incorrect "fix-it" suggestion)

from array.

mclow avatar mclow commented on May 17, 2024 1

Submitted https://bugs.llvm.org/show_bug.cgi?id=47566 against clang.

from array.

thomthom avatar thomthom commented on May 17, 2024

In a build with warnings as errors this would break the build. What would be a good way to mute these warnings? Use #pragmas to push/pop disable this specific warning before including the boost header?

from array.

mclow avatar mclow commented on May 17, 2024

I don't know where that warning is coming from.
Is it coming from the compiler? If so, what are the options passed to the compiler, and what's the full error message?

from array.

mclow avatar mclow commented on May 17, 2024

This sample:

#include <boost/array.hpp>

int main () {
	boost::array<int, 5> arr;
	return arr.size();
	}

when compiled with Apple clang version 11.0.3 (clang-1103.0.32.62) as:
clang++ -Wall -Wextra -I $BOOST junk.cpp gives no warnings, no errors

from array.

thomthom avatar thomthom commented on May 17, 2024

I can check when I'm back in office. But the warning I had to disable was -Wcomma.

from array.

shreegilliorkar avatar shreegilliorkar commented on May 17, 2024

Hey, i am Shree. New in open source contribution. My technical skills include C, C++, Python & Java. Can I please get some guidance for this project.

from array.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.