https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70229

            Bug ID: 70229
           Summary: error: constexpr constructor does not have empty body
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pangbw at gmail dot com
  Target Milestone: ---

$ cat x.cpp
#define _CONST_FUN constexpr

template<class _Rep,
         class _Period>
        class duration
{ // represents a time duration                                                 
public:
  typedef duration<_Rep, _Period> _Myt;
  typedef _Rep rep;
  typedef _Period period;

  template<class _Rep2,
           class _Period2>
  _CONST_FUN duration(int xx)
  { // construct from a duration                                                
        typedef int test;

    static_assert(0 == 0,
                  "period not an instance of std::ratio");
  }
};

$ ./xgcc -c -std=c++11 x.cpp -B.
x.cpp: In constructor ‘duration<_Rep, _Period>::duration(int)’:                 
x.cpp:21:3: error: constexpr constructor does not have empty body              
    }                                                                          
  |
   ^    

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c,c++
Thread model: posix
gcc version 6.0.0 20160314 (experimental) (GCC)

Reply via email to