Project

General

Profile

Bug #13995

Ambiguous operator overload when building table_insertionOperator_t with Clang

Added by Ben Morgan almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
10/03/2016
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:
Duration:

Description

Compiling fhicl-cpp on macOS (El Cap, Xcode 7, 8) results in an error compiling table_insertionOperator_t.cc:

[ 85%] Building CXX object fhiclcpp/test/types/CMakeFiles/table_insertionOperator_t.dir/table_insertionOperator_t.cc.o
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:84:10: error: use of overloaded operator
      '<<' is ambiguous (with operand types '(anonymous namespace)::Logger' and 'Table<(anonymous namespace)::Config>')
  logger << config;
  ~~~~~~ ^  ~~~~~~
/.../fhiclcpp/types/Table.h:81:25: note: candidate function [with T =
      (anonymous namespace)::Logger &, U = (anonymous namespace)::Config]
  inline decltype(auto) operator<<(T&& t, Table<U> const& u)
                        ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:35:13: note: candidate function [with T =
      fhicl::Table<(anonymous namespace)::Config, void>]
    Logger& operator<<(T const& t)
            ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:87:36: error: use of overloaded operator
      '<<' is ambiguous (with operand types '(anonymous namespace)::Logger' and 'Table<(anonymous namespace)::Config>')
  Logger const logger2 = (Logger() << config);
                          ~~~~~~~~ ^  ~~~~~~
/.../fhiclcpp/types/Table.h:81:25: note: candidate function [with T =
      (anonymous namespace)::Logger, U = (anonymous namespace)::Config]
  inline decltype(auto) operator<<(T&& t, Table<U> const& u)
                        ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:35:13: note: candidate function [with T =
      fhicl::Table<(anonymous namespace)::Config, void>]
    Logger& operator<<(T const& t)
            ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:95:10: error: use of overloaded operator
      '<<' is ambiguous (with operand types '(anonymous namespace)::Logger' and 'OptionalTable<(anonymous namespace)::Config>')
  logger << config;
  ~~~~~~ ^  ~~~~~~
/.../fhiclcpp/types/OptionalTable.h:80:25: note: candidate function [with T =
      (anonymous namespace)::Logger &, U = (anonymous namespace)::Config]
  inline decltype(auto) operator<<(T&& t, OptionalTable<U> const& u)
                        ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:35:13: note: candidate function [with T =
      fhicl::OptionalTable<(anonymous namespace)::Config>]
    Logger& operator<<(T const& t)
            ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:98:36: error: use of overloaded operator
      '<<' is ambiguous (with operand types '(anonymous namespace)::Logger' and 'OptionalTable<(anonymous namespace)::Config>')
  Logger const logger2 = (Logger() << config);
                          ~~~~~~~~ ^  ~~~~~~
/.../fhiclcpp/types/OptionalTable.h:80:25: note: candidate function [with T =
      (anonymous namespace)::Logger, U = (anonymous namespace)::Config]
  inline decltype(auto) operator<<(T&& t, OptionalTable<U> const& u)
                        ^
/.../fhiclcpp/test/types/table_insertionOperator_t.cc:35:13: note: candidate function [with T =
      fhicl::OptionalTable<(anonymous namespace)::Config>]
    Logger& operator<<(T const& t)
            ^
4 errors generated.

I'm not well up enough on the current standard to know whether this is a genuine issue (GCC bug/being too clever), or a Clang/LLVM bug.

I can patch the test by using .operator<< but that's only the get things to compile and not a true solution. Upstream dependents (message facility and canvas) are not yet affected so far, but am not sure if this is because they do not use the relevant code yet.

History

#1 Updated by Kyle Knoepfel almost 3 years ago

  • Status changed from New to Accepted

We will review the patch and apply as appropriate.

#2 Updated by Kyle Knoepfel over 2 years ago

  • Status changed from Accepted to Assigned
  • Assignee set to Kyle Knoepfel
  • Estimated time set to 1.00 h

#3 Updated by Kyle Knoepfel over 2 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

Resolved with commits:

#4 Updated by Kyle Knoepfel over 2 years ago

  • Status changed from Resolved to Closed
  • Target version set to 2.06.02


Also available in: Atom PDF