bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Configure check for static_cast is broken


From: Dmitri Gribenko
Subject: Configure check for static_cast is broken
Date: Wed, 10 Apr 2013 18:46:21 +0300

Dear ncurses maintainers,

Configure fails to detect that clang 3.2 fully supports a c++98
feature -- static_cast because the code that it uses to check this is
not valid c++.

configure:19038: checking if clang++ accepts static_cast
configure:19096: clang++ -c -fPIC -O2 -march=native
-I/opt/eb/software/OpenBLAS/0.2.6-cgompi-1.1.6-LAPACK-3.4.2/include
-I/opt/eb/software/ScaLAPACK/2.0.2-cgompi-1.1.6-OpenBLAS-0.2.6-LAPACK-3.4.2/include
-I/opt/eb/software/FFTW/3.3.3-cgompi-1.1.6/include -D_GNU_SOURCE
-DNDEBUG conftest.cc >&5
configure:19078:64: error: no matching constructor for initialization
of 'NCursesPanel'
  NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
                                                               ^
configure:19057:3: note: candidate constructor not viable: requires at
least 2 arguments, but 0 were provided
  NCursesPanel(int nlines,
  ^
configure:19054:7: note: candidate constructor (the implicit copy
constructor) not viable: requires 1 argument, but 0 were provided
class NCursesPanel
      ^
1 error generated.
configure:19099: $? = 1
configure: failed program was:
#line 19052 "configure"
#include "confdefs.h"

class NCursesPanel
{
public:
  NCursesPanel(int nlines,
               int ncols,
               int begin_y = 0,
               int begin_x = 0)
  {
  }

  ~NCursesPanel();
};

template<class T> class NCursesUserPanel : public NCursesPanel
{
public:
  NCursesUserPanel (int nlines,
                    int ncols,
                    int begin_y = 0,
                    int begin_x = 0,
                    const T* p_UserData = static_cast<T*>(0))
    : NCursesPanel (nlines, ncols, begin_y, begin_x)
  {
  };
  NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
  {
  };

  virtual ~NCursesUserPanel() {};
};

int
main ()
{

        const char* p_UserData = static_cast<char*>(0)
  ;
  return 0;
}
configure:19123: result: no

GCC does not rigorously check uninstantiated templates, so it compiles
the code as written just fine.  But, if you add a line in main():

NCursesUserPanel<char *> panel;

GCC will reject this program, too:

/tmp/zz.cc: In constructor
'NCursesUserPanel<T>::NCursesUserPanel(const T*) [with T = char*]':
/tmp/zz.cc:38:   instantiated from here
/tmp/zz.cc:25: error: no matching function for call to
'NCursesPanel::NCursesPanel()'
/tmp/zz.cc:4: note: candidates are: NCursesPanel::NCursesPanel(int,
int, int, int)
/tmp/zz.cc:2: note:                 NCursesPanel::NCursesPanel(const
NCursesPanel&)

I'm using Clang 3.2, ncurses-5.9-20130406.

I would be happy to provide more information to help resolve this bug.

Dmitri Gribenko

--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <address@hidden>*/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]