jwakely added inline comments.

================
Comment at: clang/lib/Parse/ParseExprCXX.cpp:2245
+  case tok::kw___ibm128:
+    DS.SetTypeSpecType(DeclSpec::TST_ibm128, Loc, PrevSpec, DiagID, Policy);
+    break;
----------------
hubert.reinterpretcast wrote:
> qiucf wrote:
> > hubert.reinterpretcast wrote:
> > > qiucf wrote:
> > > > hubert.reinterpretcast wrote:
> > > > > Not sure what the best method is to implement this, but `long double` 
> > > > > and `__ibm128` are the same type for GCC when `-mabi=ibmlongdouble` 
> > > > > is in effect.
> > > > Seems clang is also different from GCC under `-mabi=ieeelongdouble`? I 
> > > > saw `__float128` and `long double` are the same for GCC but not for 
> > > > clang.
> > > Have you checked whether the new libstdc++ for which this support is 
> > > being added needs the GCC behaviour to work properly?
> > > 
> > > The GCC behaviour allows the following to be compiled without introducing 
> > > novel overload resolution tiebreakers:
> > > ```
> > > void f(__float128);
> > > void f(__ibm128);
> > > void f(int);
> > > 
> > > long double ld;
> > > 
> > > int main() { f(ld); }
> > > ```
> > As I saw both GCC and clang have error for ambiguous `operator<<` for:
> > 
> > ```
> >     std::cout << "long double:\n";
> >     std::cout << std::numeric_limits<long double>::max() << std::endl;
> >     std::cout << std::numeric_limits<long double>::min() << std::endl;
> > 
> >     std::cout << "__float128:\n";
> >     std::cout << std::numeric_limits<__float128>::max() << std::endl;
> >     std::cout << std::numeric_limits<__float128>::min() << std::endl;
> > 
> >     std::cout << "__ibm128:\n";
> >     std::cout << std::numeric_limits<__ibm128>::max() << std::endl;
> >     std::cout << std::numeric_limits<__ibm128>::min() << std::endl;
> > ```
> @jwakely, are the overload resolution errors expected? @qiucf, are you sure 
> you have a sufficiently new libstdc++?
> @jwakely, are the overload resolution errors expected? 

Yes. Iostreams support `long double` but not `__float128`, unless that happens 
to be the same type as `long double` (due to a `-mabi=ieeelongdouble` option).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93377/new/

https://reviews.llvm.org/D93377

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to