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

            Bug ID: 68985
           Summary: braced initializer bug when defining a static
                    constexpr int within a class
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The follow code compiles fine with clang
(http://melpon.org/wandbox/permlink/VNNQJW7whi3CmEKH) but gives this error with
gcc:

prog.cc:12:39: error: cannot convert 'my_t<I, T>' to 'const int' in
initialization
   static constexpr int x = my_t<I, T>{};
                                       ^

////////////////////////////////////////////////////////////////
template <int I>                                                                
struct A{                                                                       
  constexpr operator int() { return I; }                                        
};                                                                              

template <int I, class T>                                                       
using my_t = A<I>;                                                              

template<int I, class T>                                                        
class B {                                                                       
 public:                                                                        
  static constexpr int x = my_t<I, T>{};                                        
};                                                                              

int main() {                                                                    
  return 0;                                                                     
} 
////////////////////////////////////////////////////////////////

Reply via email to