Opened 4 years ago
#13583 new Bugs
quantities can be assigned from cmath sqrt result, but not initialized
| Reported by: | Owned by: | Matthias Schabel | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | units |
| Version: | Boost 1.67.0 | Severity: | Problem |
| Keywords: | Cc: |
Description
The cmath functions are very helpful in letting me perform math on quantities, but I ran across an inconsistency. Code like:
quantity<wavenumber, float> x, y;
quantity<wavenumber, float> foo = sqrt(x*x + y*y);
fails to compile (with an "error: conversion from..."). The workaround is to use an assignment instead:
quantity<wavenumber, float> foo;
foo = sqrt(x*x + y*y);
It seems odd to have this restriction (and it's certainly undocumented) so I suspect it is a bug.
Attachments (1)
Note:
See TracTickets
for help on using tickets.

minimal test case