[Dune-devel] [PATCH] Use unqualified calls to allow ADL.

Atgeirr Rasmussen Atgeirr.Rasmussen at sintef.no
Wed Sep 2 09:05:47 CEST 2015


Hello again, Dune!

Yesterday I promised:
I will try to provide a minimal example tomorrow.

This is the minimal example. I compiled with the following command line (from my dune-common directory):

clang++ -std=c++11 -I. -o adlfail adlfail.cpp build-cmake/lib/libdunecommon.a

The version of clang is

Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)

The source code to adlfail.cpp follows below. With current master, the include can be moved below Num
(currently commented out) to compile successfully, with the patch applied it does not matter (and the
absreal needs only to be defined in namespace Foobar).

I have also attached a new patch to this email, the only difference is that this is against the master branch.

Atgeirr

========================================
#include <dune/common/fmatrix.hh>

namespace Foobar
{
    struct Num
    {
        Num() {}
        Num(double) {}
        Num operator+(Num) const { return Num(); }
        Num operator-(Num) const { return Num(); }
        Num operator*(Num) const { return Num(); }
        Num operator/(Num) const { return Num(); }
        Num& operator+=(Num) { return *this; }
        Num& operator-=(Num) { return *this; }
        Num& operator*=(Num) { return *this; }
        Num& operator/=(Num) { return *this; }
        bool operator<(Num) const { return false; }
        bool operator>(Num) const { return false; }
    };

    Num operator/(double, Num) { return Num(); }

    double absreal(const Num&) { return 0.0; }
}

namespace Dune
{
    namespace fvmeta
    {
        using Foobar::absreal;
    }
}

// #include <dune/common/fmatrix.hh>

int main()
{
    typedef Dune::FieldMatrix<Foobar::Num, 2, 2> Matrix;
    typedef Dune::FieldVector<Foobar::Num, 2> Vector;

    Matrix M;
    Vector x, y;
    M.solve(x, y);
    return 0;
}
=================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150902/0e94973a/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-unqualified-calls-to-allow-ADL.patch
Type: application/octet-stream
Size: 7105 bytes
Desc: 0001-Use-unqualified-calls-to-allow-ADL.patch
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150902/0e94973a/attachment.obj>


More information about the Dune-devel mailing list