Comments (8)
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.
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.
Submitted https://bugs.llvm.org/show_bug.cgi?id=47566 against clang.
from array.
In a build with warnings as errors this would break the build. What would be a good way to mute these warnings? Use #pragma
s to push/pop disable this specific warning before including the boost header?
from array.
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.
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.
I can check when I'm back in office. But the warning I had to disable was -Wcomma
.
from array.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from array.