Bug 51486 - g++ doesn't implicitly search for <decimal> header in system include path include/c++/<version>/decimal/
Summary: g++ doesn't implicitly search for <decimal> header in system include path inc...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-09 16:17 UTC by Ryan S. Arnold
Modified: 2011-12-10 00:47 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan S. Arnold 2011-12-09 16:17:49 UTC
The following testcase fails when compiled without specifying the explicit include path for the decimal/decimal header:

  decimal.cpp
  ---------------------------------------------------------------------------
  #include <decimal>
  using namespace std::decimal;

  int main() {
          decimal64 d64;
          decimal128 d128;
          /* extendddtd2  */
          d128 = d64;
          return 0;
  }

  $ /opt/at5.0/bin/g++ -m64 -O0 decimal.cpp -o decimal
  decimal.cpp:1:19: fatal error: decimal: No such file or directory
  compilation terminated.

When the include path is included explicitly compilation works fine:

  $ /opt/at5.0/bin/g++ -isystem /opt/at5.0/include/c++/4.6.2/decimal/ -m64 -O0 decimal.cpp -o decimal

Here's the version information for the compiler:

  $ /opt/at5.0/bin/g++ -v 2>&1  | grep version
  gcc version 4.6.2 20110919 (Advance-Toolchain-5.0-1) [ibm/gcc-4_6-branch revision 181060] (GCC)

I'm operating under the assumption that #include <decimal> should pick up the include/c++/4.6.2/decimal/decimal header automatically without having to specify -isystem on compiler invocation.
Comment 1 Paolo Carlini 2011-12-09 16:26:43 UTC
The entire testsuite uses <decimal/decimal>, can't be by chance. Let's add Janis in CC, maybe she can give you further clarifications.
Comment 2 Jonathan Wakely 2011-12-09 16:31:44 UTC
I assume the reasoning is similar to how we require users to include <tr1/memory> to get TR1's <memory>
Comment 3 Ryan S. Arnold 2011-12-09 16:39:17 UTC
Thanks.  Using #include <decimal/decimal> instead of #include <decimal> does indeed work.  I'm just wondering what's correct.
Comment 4 Paolo Carlini 2011-12-09 16:47:48 UTC
With the difference vs tr1, that in this case, as far as I can see, there are no name collision issues, thus installing both decimal and decimal.h at the the same level of the the other standard headers would be trivial, if we wanted.
Comment 5 Janis Johnson 2011-12-09 17:04:04 UTC
Header <decimal> didn't go with the standard headers because it's not part of the standard.  My first couple of patches put it in <tr24733/decimal> on the recommendation of Benjamin Kosnik.  Ed Smith-Rowland in <http://gcc.gnu.org/ml/libstdc++/2009-10/msg00012.html> suggested putting it in <decimal/decimal> instead, where it would be just as hidden from standard files but more recognizable.  Benjamin agreed and made that change.

I don't care where it goes, just wanted to clarify why it is where it is now.
Comment 6 Paolo Carlini 2011-12-09 20:08:37 UTC
Agreed. Thus, I understand the behavior is absolutely intended, and I see no compelling reason to change it now.
Comment 7 Ryan S. Arnold 2011-12-09 20:50:50 UTC
(In reply to comment #6)
> Agreed. Thus, I understand the behavior is absolutely intended, and I see no
> compelling reason to change it now.

Would you see this changing to be located in the standard include directory should the ratification of the TR take place?  (yeah I know, we're probably on the order of geologic time for that to happen)
Comment 8 Jonathan Wakely 2011-12-10 00:47:16 UTC
personally, yes, I'd be happy with <decimal> when it's a standard